VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 1 of 1
Thread
  1. Member xplorr's Avatar
    Join Date
    Feb 2017
    Location
    Europe
    Search PM
    Since Youtube Music has no import/export/syncing functions (yet) to sync playlists with a local music collection, I decided to write some Python scripts myself to sync my WACUP/WinAmp m3u8 playlists to Youtube Music. I named my toolkit WinaYo and decided to share it as freeware. Enjoy!

    Introduction to WinaYo

    WinaYo is a freeware command line toolkit and user-interface to update/sync/delete and import/export Youtube Music playlists (YTM) with local playlists (m3u8) using Python and ytmusicapi. The target audience are people who have organized their music and playlist collection using a local media player like WinAmp, WACUP, ... and want to sync their collection to YTM. Currently YTM has no tool to sync local playlists. WinaYo fills this gap.
    WinaYo also allows to backup your YTM playlists to csv files, which you can edit in Excel or WinAmp, WACUP, ... and import back into YTM. Deleting all your playlists is also supported. WinaYo can easily be modified to sync playlists from other local music players/managers.

    Important remarks/limitations

    WinaYo asumes that the filenames of your song collection are formatted as <Artist> - <Title>.mp3. If this is not the case, either you need to adjust WinaYo to fit another naming convention (see 4-WinAmp2GooglePlayList.bat) or you can easily reformat either your filenames or your tags to make them consistent using mp3tag.
    WinaYo will not delete or create songs in YTM, only playlists are deleted/recreated/updated. To delete or upload songs you can use the YTM webclient.
    Ytmusicapi has no reliable way of returning the YTM songids (recently) added, so every time you upload a batch of new songs to YTM, you should export all YTM songids to update the local database.
    A maximum of 100000 songid's can be handled.
    A maximum of 1000 playlists can be handled.
    A maximum of 5000 songs per playlist can be handled (if playlists are >5000 songs, they will be automatically split into "<name> Part 1,2,3,...")
    There is a limit on the number of Youtube apicalls Google allows (quota limit unknown)

    Version History

    Version 1.0 (14/08/2020) export YTM songsids and playlists functions
    Version 1.1 (16/08/2020) import/create playlists functions
    Version 1.2 (20/08/2020) delta updating functions
    Version 1.3 (23/08/2020) user-interface implemented

    Download and Installation

    Download WinaYo.zip.
    Unzip WinaYo.zip to a permanent directory (f.i. C:\WinaYo).

    License

    This software is distributed as freeware.



    Prerequisites

    Install Python >=3.5 from https://www.python.org/downloads/ (future versions may include compiled .exe's so to avoid the need for installing python)
    Install python ytmusicapi (by sigma67): pip install ytmusicapi (see https://github.com/sigma67/ytmusicapi)
    Install python configparser: pip install configparser
    Install other unknown python modules when receiving errors: pip install <module>
    Add a valid YTM cookie in the file "headers_auth.json" to authenticate (replace cookie data between "")(see below)
    Optional: Download and install "ML Exporter v1.0" for WinAmp to export all Smart Views (see http://winampplugins.co.uk/mlexporter.html) (builtin in WACUP)
    Optional: Install rxrepl.exe from https://sites.google.com/site/regexreplace/ (already included in this project zip)
    Optional: Install csvquery.exe (already included in this project zip)
    Optional: "import" and "export" folders contain some example playlists for demo purposes (files can be deleted)

    Get a valid YTM Cookie using Chrome/Chromium/Edge to authenticate

    open https://music.youtube.com in Chrome/Chromium/Edge
    open dev tools (ctrl-shift-i)
    do some action in main page (f.i. open playlists)
    goto network tab
    filter on "json" and select latest entry
    look in "header" tab for string "cookie" and copy data
    open "headers_auth.json" and copy cookie data to "cookie" and save
    remark: this cookie will be valid as long as you don't logout from YTM

    Collect/Export WinAmp/WACUP SmartView Playlists (auto generated) to m3u8

    Create a WinAmp/WACUP Smartview called "All" containing all your WinAmp/WACUP songs (query: artist ISNOTEMPTY AND title ISNOTEMPTY) (needed to compare against YTM later-on)
    Open WinAmp/WACUP and click in lower left corner on "Library/Export/Smart Views/All Smart Views"
    Select m3u8 format and folder "import"
    Remark: Sometimes export fails, fix: restart WinAmp/WACUP and immediately do the export as fast as possible (also disable WinAmp/WACUP option: preferences/media library/local library/rescan folders at startup)

    Collect/Export WinAmp/WACUP Static Playlists (manually created) to m3u8

    Select (static) "Playlists" foldertab and select all (static) playlists you want to upload to YTM and click "Save"
    Select m3u8 format and folder "import"

    Scenario 1: Create and export WinAmp/WACUP playlists to YTM (initial upload)

    First upload your WinAmp/WACUP songs collection to YTM using the YTM webclient (initial upload)(at the moment there is no other decent upload tool).
    Collect/export your WinAmp/WACUP smartviews and static playlists into folder "import" (as described above).
    Edit file "PlaylistsToDelete.txt" containing the names of the YTM playlists to delete (valid names can be found in file "export\Playlists.csv" after step 1)
    Edit file "PlaylistsToCreate.txt" containing the names of the WinAmp/WACUP playlists to create in YTM (see folder import after step 4)
    Perform the following steps:

    Run 0-CorrectWAPlayListPaths.bat : locally remove unwanted WinAmp/WACUP playlists and correct songpaths (you have to review the bat file to your needs)
    Run 1-ExportYTMusicLibrary.bat : export all uploaded YTM songid's in a playlist called "export\All.csv" and YTM playlistid's to "export\Playlists.csv" (run initially and when new songs are uploaded to YTM)
    Run 2-ExportYTMusicPlayLists.bat : export all YTM playlists to a folder "export" (run as a backup and to check differences with WinAmp/WACUP later-on)
    Run 3-DeleteYTMusicPlayLists.bat : delete all YTM playlists specified in file "PlaylistsToDelete.txt" (run only when you want to (re-)upload all playlists later-on)
    Run 4-WinAmp2YTMusicPlayLists.bat : locally convert the WinAmp/WACUP playlist csv's to YTM playlist csv's with matching YTM songid's (after running 1-ExportYTMusicLibrary.bat)
    Run 5-CreateYTMusicPlayLists.bat : create and upload all WinAmp/WACUP playlists to YTM playlists specified in file "PlaylistsToCreate.txt" (new YTM playlists are created!)

    Remark: everytime you upload a batch of new songs to YTM, you should run "1-ExportYTMusicLibrary.bat" to update the local songid database.

    Scenario 2: Sync WinAmp/WACUP playlists to YTM (append/remove)

    Use this scenario to sync(append/remove) your playlists after you initially performed Scenario 1 (initial upload)(use this for relatively smaller delta's).
    Collect/export your WinAmp/WACUP smartviews and static playlists into folder "import" (as described above).
    Edit file "PlaylistsToUpdate.txt" containing the names of the YTM playlists to update (valid names can be found in file "export\Playlists.csv" after step 1)
    Remark: current version of WinaYo does not allow to sync(append/remove) split playlists (>5000 songs, with <name> split into "<name> Part 1,2,3,...")(use DeleteList.py() and CreateList.py() instead)
    Perform the following steps:

    Run 0-CorrectWAPlayListPaths.bat : locally remove unwanted WinAmp/WACUP playlists and correct songpaths (you have to review the bat file to your needs)
    Run 4-WinAmp2YTMusicPlayLists.bat : locally convert the WinAmp/WACUP playlist csv's to YTM playlist csv's with matching YTM songid's (after running 1-ExportYTMusicLibrary.bat)
    Run 6-WASongsNotInYT.bat : report songs in WinAmp/WACUP not present in YTM and save result in "delta\WASongsNotInYT.csv" (optional)
    Run 7-YTSongsNotInWA.bat : report songs in YTM not present in WinAmp/WACUP and save result in "delta\YTSongsNotInWA.csv" (optional)
    Run 8-CopyWASongsNotInYT2Temp.bat : copy new songsfiles(mp3) present in WinAmp/WACUP but not in YTM to "temp" folder (upload to YTM using YTM webclient)(files may be removed after uploading)
    Run 1-ExportYTMusicLibrary.bat : export all uploaded YTM songid's in a playlist called "export\All.csv" and YTM playlistid's to "export\Playlists.csv" (run only when new songs are uploaded to YTM)
    Run 9-UpdateYTMusicPlayLists.bat : update/sync only YTM playlists different From WinAmp/WACUP playlists specified in "PlaylistsToUpdate.txt" (append/remove songs from YTM playlists)
    Run 2-ExportYTMusicPlayLists.bat : export all YTM playlists to a folder "export" (run only to update local YTM playlists to check differences with WinAmp/WACUP later-on)

    Remark: everytime you upload a batch of new songs to YTM, you should run "1-ExportYTMusicLibrary.bat" to update the local songid database.

    Using the Userinterface

    Scenarios 1 and 2 are also available via the userinterface "WinaYo.exe". Actions are grouped in 4 groups:

    Export Youtube Music Database
    Prep/Convert WinAmp/WACUP Playlists
    Report/Gather Song Differences
    Create/Update/Delete Youtube Music Playlists

    The left column of actionbuttons start one of the above mentionned .bat files.
    The right column of actionbuttons allow to browse the folders, edit the preferences files or view the reports.
    Remark: everytime you upload a batch of new songs to YTM, you should click "Export Youtube Music Songids" to update the local songid database.

    Disclaimer

    This software and the accompanying files are supplied "as is", without any express or implied warranty. In no event shall the author be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages from the use of this software. By using this software you agree with these conditions.
    Last edited by xplorr; 7th Sep 2020 at 07:07.
    Quote Quote  



Similar Threads