Just some scripts

Just some scripts

A bunch of Windows scripts, working on Win10 as of Jan. 1st, 2019, with youtube-dl working as of Mar. 4th, 2020. Legend: program directory file code variable key

Audiovisual media downloader (youtube-dl)

Useful for backing media up directly from social networking sites. Originally from yt-dl.org, which I updated to include FFmpeg to merge audio/video and RTMPDump to download Flash files (details). I also renamed it so you just need to type in yt and not youtube-dl in your commands for efficiency. If you want to be extra safe, download the files listed above directly. If you don’t mind taking a risk, download the RAR file I compiled containing all of them in step one below. It should be safe but I cannot personally guarantee this. If you’re running Linux, both the install and some commands are different.

  1. Download, unzip, and then copy YT scripts into a folder in your C:/ directory (ie. C:/yt)
  2. Enter command prompt/terminal (Windows: ⊞ Win + r, type in cmd)
  3. Type in cd c:/yt to enter the C:/yt directory.
  4. Type yt -U → to update to the latest release (do this often).
  5. Type in any of the following (get the spaces and capitalization right; file will be in your C:/yt folder.):
    • yt URL → Download highest quality video
    • yt playlist ID or yt playlist URL → Download all videos in a playlist (see notes below)
    • yt channel URL → Download all videos uploaded to a channel (more options here)
    • yt URL --video-password password → Download password-protected video
    • yt URL --write-sub → Download subtitles
    • yt URL --write-auto-sub --sub-lang=language → Download auto-generated subtitles (eg. --sub-lang=en for English)
    • yt -f 140 URL → Download audio as .m4a
    • yt -f 140 playlist ID → Download all audio in a playlist as .m4a
    • yt -x --audio-format mp3 URL → Download audio and then convert it to an .mp3
    • yt -F URL → List all available download formats
    • yt -h → Help (ie. list all options).

Notes: URL = YouTube/Vimeo/Facebook/Reddit/TED/BBC/etc URL. Eg. yt youtu.be/tEz2Xc2MK2o will download the video; yt -f 140 https://www.youtube.com/watch?v=tEz2Xc2MK2o would download just the audio. The playlist ID in this playlist URL, youtube.com/watch?v=7oXrGXt0mRc&list=PL3fxfEw38nFeYcdFqC23NV9TeZckrMVDY, is bold. For subtitles to work, place both resulting video and .vtt files in the same folder, open the video in VLC, and enable them under the “Subtitles” menu; more options here.

Torrent streaming

Using Peerflix on Windows to stream torrent magnet links directly in VLC.

  1. Install VLC and Node.js.
  2. Enter command prompt/terminal (Windows: ⊞ Win + r, type in cmd)
  3. Install Peerflix via terminal by typing in npm install -g peerflix
  4. Get Magnet link from torrent index (eg. MagnetDL)
  5. Enter peerflix "URL" --vlc (the quotes are necessary only for links containing ampersands (“&”)).
    Eg: peerflix magnet:?xt=urn:btih:ef330b39f4801d25b4245212e75a38634bfc856e --vlc

Batch song file renaming

Renaming song filenames to match iTunes tags.

  1. Download Steve MacGuire’s CustomRenamer (link) and EnableLUA (link) scripts. Location doesn’t matter.
  2. Back up your music library.
  3. Update the songs you want renamed in iTunes. Highlight these songs.
  4. Run EnableLUA.vbs. Not necessary but this disables some Windows settings enabling a progress bar to show up: useful for visualizing progress).
  5. Run CustomRenamer.vbs:
    • Choose your destination folder (a new one means new files will be created there; the same one means files in there will simply be renamed).
    • Choose your preferred filename format (eg. <Name> (<Artist>, <Year>).
    • The default of Music\<Name> (<Artist>, <Year>) will create a /Music subfolder housing the changed tracks. iTunes will reference the new tracks as the correct ones wherever they are saved by the script.
    • Execute command. If you ran EnableLUA you might be asked to set up/use Internet Explorer. Allow this to see the progress bar.
    • If you’re renaming into the same folder it may ask you to delete duplicate files. Luckily you have a backup so go ahead and revisit after.
  6. Run EnableLUA.vbs to re-enable Windows default settings if you disabled them earlier.

Rendering charts and graphs using HTML

Right-click and download charts.html and open it in a text editor to edit the values within.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.