New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playlist Import #3

Closed
chrisrohn opened this Issue Sep 23, 2015 · 15 comments

Comments

Projects
None yet
8 participants
@chrisrohn

chrisrohn commented Sep 23, 2015

I'm sure this is near the top of your list already, but it is of the most basic and imperative nature that we have the ability to import playlists from youtube accounts, soundcloud accounts, and search/build playlists from the .json files everyone is exporting from plug.dj or other services. This should be implemented as soon as possible to assist those who would like to transition services sooner than later.

@nambok nambok added the feature label Sep 23, 2015

@nambok

This comment has been minimized.

Contributor

nambok commented Sep 23, 2015

@chrisrohn we are working on this, in the meantime one of our users created this importer https://dubtrack-playlist.appspot.com/ you could try that

@chrisrohn

This comment has been minimized.

chrisrohn commented Sep 23, 2015

I have over 200 playlists. The 2nd party importer doesn't display all of my playlists individually and also resulted in a temp ban when I tried to download all. http://i.imgur.com/cSPxRMF.png

@nambok

This comment has been minimized.

Contributor

nambok commented Sep 23, 2015

@chrisrohn that sucks will try to get this up and running soon

@nambok

This comment has been minimized.

Contributor

nambok commented Sep 23, 2015

@chrisrohn do you have a .json file I can use as sample?

@chrisrohn

This comment has been minimized.

chrisrohn commented Sep 23, 2015

this is an example json that is created with the pye.sq10.net exporter a lot of people are using: https://www.dropbox.com/s/ycoauoq705127vd/PLUG_PLAYLISTS.json?dl=0

@aemixdp

This comment has been minimized.

aemixdp commented Sep 29, 2015

I've reversed a code little bit and tried to handcraft some data, but this doesn't work as well:

{"data":[{"cid":"kgsqoEPIeug"},{"cid":"g4CSO1-I5vc"},{"cid":"XqsdkHF2f4Q"},{"cid":"9G0YDnRFkk4"},{"cid":"PZdt5nS3CFc"}]}
@djaybe

This comment has been minimized.

djaybe commented Sep 29, 2015

a couple awsome folks (@jacknapis & @aeroplanist) at https://www.dubtrack.fm/join/i-80s-and-90s helped me import my .json file playlists to dubtrak using https://dubtrack-playlist.appspot.com/:

  1. follow imported instructions
  2. enter new name for playlist in importer.
  3. open .json in notepad
  4. search and replace "playlist name" with "data"
  5. search and replace "type" to "format"
  6. search and replace "id" to "cid"
  7. copy 1 playlist beginning with "{"data":[{"format":1,"cid":" & ending with "}]}" and paste into playlist data box
@ferzrrn

This comment has been minimized.

ferzrrn commented Sep 30, 2015

@djaybe what browser you use? i try doing this in chrome & firefox but always get some errors like "SyntaxError: Unexpected token d" or "SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 4 of the JSON data"

@djaybe

This comment has been minimized.

djaybe commented Sep 30, 2015

i used chrome Version 45.0.2454.101 m
i included #7 to give specific context for what needs to be copied. if you have too many braces or brackets at the end you will get an unexpected error. verify that the end of each playlist ends with }]}
(by default a json file adds an extra brace at the end apparently)
here is an exact sample context of a small complete playlist that would get copied into the playlist data box:
{"data":[{"format":1,"cid":"bDbpzjbXUZI"},{"format":1,"cid":"DJ6tW17kpQw"},{"format":1,"cid":"s0dxhSPoBjY"}]}

also, if you are importing multiple playlists you may need to reload the page after every list import as the plugin seems to stick, then launch the booklet again.

hope this helps!

@jgm106

This comment has been minimized.

jgm106 commented Sep 30, 2015

A quick CLI blurb. If you have a PLUG_PLAYLISTS.json, grab jq and run this. then you can cut'n'paste the playlists as you desire.

cat PLUG_PLAYLISTS.json | sed 's/"type"/"format"/g' | sed 's/"id"/"cid"/g' | ./jq -c '{data: .playlists[]}'

@djaybe

This comment has been minimized.

djaybe commented Sep 30, 2015

my advisers tell me this code would work on linux/osx but not for windows.
#disclaimer

@ydrecords

This comment has been minimized.

ydrecords commented Sep 30, 2015

On Windows, you can install UnxUtils (http://unxutils.sourceforge.net/) to get access to cat and sed. Also need to get the windows version of jq.exe and put it in your PATH or current directory. Then the following worked for me from the command window (note that single quotes needed to be changed to double quotes in the argument for jq):

cat PLUG_PLAYLISTS.json | sed 's/"type"/"format"/g' | sed 's/"id"/"cid"/g' | jq -c "{data: .playlists[]}" > CONVERTED_PLUG_PLAYLISTS.txt

@djaybe

This comment has been minimized.

djaybe commented Oct 1, 2015

that's great - thanks!

@jgm106

This comment has been minimized.

jgm106 commented Oct 2, 2015

Here's a lazy CLI option based on output from Google Takeout:

requirement:
you need to use a command line interface (CLI). therefore you will have to be on an OSX, Linux, or UNIX variant, or be running unxutils or cygwin on Windows.

Sign in to google and go to https://myaccount.google.com/privacy#takeout
Under the right-side heading named “Download Your Data”, click on “Create Archive”.
Click the “Select none” button to clear out everything except Youtube.
For Youtube you should see a dropdown, click it and select “Select specific data” and be sure only playlists are selected. Then change “Subscriptions” to “JSON” Click Next, download the file, and extract it.
For each of the extracted ".json" files (from the .zip file from the last step), run the following [Be sure to replace PLAYLIST.json with an actual file name]

grep videoId "PLAYLIST.json" | awk ' BEGIN { ORS=" "; print "{"data":["; } NR%2==1 { printf c "{"format":1, "cid": %s}", $3; c=","; } END { print "]}\n" }'

should result in output similar to this:
{"data":[ {"format":1, "cid": "L0MK7qz13bU"},{"format":1, "cid": "KNCmnU8QDbI"},{"format":1, "cid": "JYZMT8otKdI"},{"format":1, "cid": "lcOxhH8N3Bo"},{"format":1, "cid": "PSROm-vgVRk"}]}

Using the importer from https://dubtrack-playlist.appspot.com/ (follow it's instructions on use) enter a playlist name and cut and paste the entire playlist from '{"data"' to ']}' into the data field (include those bits as well). hit enter.

@joedubtrack

This comment has been minimized.

joedubtrack commented Nov 10, 2015

This is now complete. We added Youtube and Souncloud importers in the playlist search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment