· 5 years ago · Feb 06, 2020, 12:24 PM
1hey.
2
3as you might see from my profile I don't upload stuff here, it's way too open for my liking. (off topic) I am however a script kiddie at heart, so I would like to share a simple idea to automate uploading and sharing stuff here using megacmd. This only works for Windows like this, feel free to add a reply with your Linux version if you know how to do it.
4
5put megacmd in enviroment variables PATH.
6
7have qBittorrent execute this on torrent completion:
8CODE: SELECT ALL
9
10cmd /c mega-put "%F" -c "%N" && cmd.exe /c megaclient export -f -a "%N" >> "%USERPROFILE%\Google Drive\megaExport.txt"
11you could put mplayer or vlc or something in your mega-put.bat if you want to play the releases first.
12
13run this autohotkey script every time storage space is running out
14CODE: SELECT ALL
15
16baseGmailUserName = your.email.handle
17currentRandom = % RegExReplace(RandomStr(), "\W", "i")
18currentGmail = %baseGmailUserName%+%currentRandom%@gmail.com
19Run, C:\Program Files\Google\Drive\googledrivesync.exe
20RunWait, megaclient logout
21RunWait, megaclient signup %currentGmail% %currentGmail%
22Sleep, 10000
23Run, https://mail.google.com/mail/u/0/#search/%currentRandom%
24WinWaitActive, Login - MEGA - Google Chrome,, 120
25 ; waiting two minutes for you to verify the link sent by email
26 ; this is the only user interaction needed
27RunWait, megaclient login %currentGmail% %currentGmail%
28FileAppend, `n%currentGmail%, %USERPROFILE%\Google Drive\megaMail.txt
29RunWait, megaclient rm -r *
30RunWait, megaclient mkdir uploads
31MsgBox % ComObjCreate("WScript.Shell").Exec("cmd.exe /q /c megaclient whoami -l").StdOut.ReadAll()
32ExitApp
33
34RandomStr(l = 8, i = 48, x = 122) { ; length, lowest and highest Asc value
35 Loop, %l% {
36 Random, r, i, x
37 s .= Chr(r)
38 }
39 Return, s
40}
41
42All this does is makes you stay in the command line, not having to poke around in the browser apart from verifying the email, and it just quietly works in the background.
43No need to keep track of login credentials for Mega accounts, it will export this to a text file.
44don't forget to set your gmail address on the first line of the script, not using the @gmail.com part, just the username
45
46also, a script to check for how much is stored on your current logged in account:
47CODE: SELECT ALL
48
49GigaBytesInRoot := % ComObjCreate("WScript.Shell").Exec("cmd.exe /q /c megaclient whoami -l | find ""ROOT""").StdOut.ReadAll()
50GigaBytesOccupied := SubStr(GigaBytesInRoot, 24, 5)
51GigaBytesOccupied := Round(GigaBytesOccupied)
52MsgBox, %GigaBytesOccupied% GB stored in root
53Edit 2: I changed it to gmail
54Edit 3: if anybody knows an email service that verifies links automatically, please let me know.
55Edit 4:
56Edit 5: added exporting links, this way you no longer need to use the browser to get your public links and removed share to base email address, because I wasn't using that