Skip to content

Instantly share code, notes, and snippets.

@askvictor
Created June 21, 2016 11:11
Show Gist options
  • Save askvictor/00a135f957ee0a240d3988565f5bc68a to your computer and use it in GitHub Desktop.
Save askvictor/00a135f957ee0a240d3988565f5bc68a to your computer and use it in GitHub Desktop.
use strict;
use warnings;
my $data = search("radiohead");
print "$data\n";
print "$data->{song_hits}\n";
print "$data->{song_hits}[0]\n";
for my $hit (@{$data->{song_hits}}){
print "$hit->{track}->{title}\n";
}
use Inline Python => <<'END_OF_PYTHON_CODE';
import gmusicapi
USERNAME="[email protected]"
PASSWORD="sooper_secr3t"
DEVICE_ID = "12345abcde123" # this can be obtained using https://raw.githubusercontent.com/squeezebox-googlemusic/squeezebox-googlemusic/master/mobile_devices.py
def search(needle):
c = gmusicapi.Mobileclient()
c.login(USERNAME, PASSWORD, DEVICE_ID)
r = c.search(needle, 2)
return r
END_OF_PYTHON_CODE
@askvictor
Copy link
Author

Produces output:

 HASH(0x1cba6e8)
[{u'track': {u'albumArtRef': [{u'url': u'http://lh3.googleusercontent.com/S7EzegIDPI54OwPL9-KNd4hIn2jDZOosfMOh6gVpyEBs397rk33UjqZh9s9IhFlbcROF3CtC', u'kind': u'sj#imageRef', u'aspectRatio': u'1', u'autogen': False}], u'artistId': [u'A3qpbllyfot4yhqo7isoomtctli'], u'composer': u'', u'year': 1993, u'trackAvailableForSubscription': True, u'trackType': u'7', u'album': u'Pablo Honey', u'title': u'Creep', u'albumArtist': u'Radiohead', u'trackNumber': 2, u'discNumber': 1, u'albumAvailableForPurchase': True, u'explicitType': u'1', u'trackAvailableForPurchase': True, u'storeId': u'Tgarv4vwobsxyxtsott6p4qok5q', u'nid': u'Tgarv4vwobsxyxtsott6p4qok5q', u'estimatedSize': u'9548304', u'albumId': u'Bgpaifizbaqexiz7gbmlga35c6a', u'genre': u"'90s Alternative", u'playCount': 1, u'kind': u'sj#track', u'artist': u'Radiohead', u'lastModifiedTimestamp': u'1463811465025533', u'durationMillis': u'238000'}, u'navigational_result': False, u'type': u'1', u'best_result': False}, {u'track': {u'albumArtRef': [{u'url': u'http://lh3.googleusercontent.com/FOJ-SO0djyr7GEFpkMJbiS-dtOltviBJwKF0lkR2F8cK1BY62jAVPfXnv-E_CrkOsfYxOxgb', u'kind': u'sj#imageRef', u'aspectRatio': u'1', u'autogen': False}], u'artistId': [u'A3qpbllyfot4yhqo7isoomtctli'], u'composer': u'', u'year': 1997, u'trackAvailableForSubscription': True, u'trackType': u'7', u'album': u'OK Computer', u'title': u'Karma Police', u'albumArtist': u'Radiohead', u'trackNumber': 6, u'discNumber': 1, u'albumAvailableForPurchase': True, u'explicitType': u'2', u'trackAvailableForPurchase': True, u'storeId': u'T5exrdzxkdxz7z4tyquklpf2jla', u'nid': u'T5exrdzxkdxz7z4tyquklpf2jla', u'estimatedSize': u'10564990', u'albumId': u'Bc5lmah5b34pzehbpiccirz3hme', u'genre': u'Brit Pop/Brit Rock', u'kind': u'sj#track', u'artist': u'Radiohead', u'durationMillis': u'264000'}, u'navigational_result': False, u'type': u'1', u'best_result': False}]
Not an ARRAY reference at sample.pl line 7.

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