Skip to content

Instantly share code, notes, and snippets.

@saltlakeryan
Last active December 15, 2015 01:59
Show Gist options
  • Save saltlakeryan/5183935 to your computer and use it in GitHub Desktop.
Save saltlakeryan/5183935 to your computer and use it in GitHub Desktop.
migrate google reader listen subscriptions to subsonic server
<?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?
?>
@saltlakeryan
Copy link
Author

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

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