Last active
December 15, 2015 01:59
-
-
Save saltlakeryan/5183935 to your computer and use it in GitHub Desktop.
migrate google reader listen subscriptions to subsonic server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$subsonic_url = "192.168.0.101:4040"; | |
$subsonic_user = "myuser"; | |
$subsonic_pass = "mypass"; | |
#Create xml object from subscriptions.xml opml file | |
$xml = new SimpleXMLElement(file_get_contents('subscriptions.xml')); | |
#Narrow feed items to just those for Google Listen with xpath | |
$listen = $xml->xpath('//outline[@title="Listen Subscriptions"]'); | |
$listen_outline = $listen[0]->outline; | |
#Log into local subsonic server with username and password, store cookies in cookies.txt | |
echo `curl -L -c cookies.txt -d 'j_username=$subsonic_user&j_password=$subsonic_pass&_acegi_security_remember_me=1' http://$subsonic_url/j_acegi_security_check\n`; | |
#Send a curl request to subsonic server to add each feed item | |
foreach($listen_outline as $elem) { | |
$url = urlencode($elem['xmlUrl']); | |
echo `curl -L -b cookies.txt -d 'add=$url' 'http://$subsonic_url/podcastReceiverAdmin.view?'\n`; | |
} | |
#Maybe should remove cookies.txt file? | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I exported my Google Listen subscriptions from google reader to the file subscriptions.xml
I put this gist in the same directory
On the command line, ran:
php opml_to_subsonic.php
confirmed that subsonic now had my subscriptions