Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Spotify for PSP (Homebrew)?

  
  1. #1
    zandmstudios is offline -Hacks Newbie
    Join Date
    Sep 2009
    Location
    Do ya really need to know?
    Posts
    7
    Rep Power
    0

    Default Spotify for PSP (Homebrew)?

    Hey, DashHacks community. I was wondering if anyone had ever thought of doing a PSP homebrew client for Spotify (available only to Premium subscribers, obviously). A whole slew of third-party clients have already been made, and it's quite easy and even supported by Spotify, as they have their library keys (libspotify, it's available on the official Spotify website) available for developers to utilize. I imagine it would be very simple to develop, just create the GUI, and then plant libspotify in it, and voila, music streaming bliss on the PSP So thanks all, for hearing me out. Peace.


  2. #2
    shivadow is offline Banned -Hacks Monk
    Join Date
    Feb 2009
    Posts
    2,598
    Rep Power
    0

    Default

    Why not download the album and stream it to your PSP with the inbuilt RSS reader?. As if people are going to pay for anything, especially if you can get it for free.

  3. #3
    zandmstudios is offline -Hacks Newbie
    Join Date
    Sep 2009
    Location
    Do ya really need to know?
    Posts
    7
    Rep Power
    0

    Default

    I understand that that is all well and simple (and free), but it's also illegal (pirating...). The point here is to have a legitimate music streaming client for PSP that isn't Qriocity, one that streams from a music database akin to Qriocity's instead of just your own music that's on your computer already. Basically, I'm looking for a streaming client on PSP that is entirely usable with just a Wi-Fi connection and nothing else. No need for your computer to be turned on, and you can search for anything and play the whole song or album right there, on demand. This is what a Spotify client for PSP would be capable of.

  4. #4
    bloodles's Avatar
    bloodles is offline Programmer -Hacks Smarty
    Join Date
    Jun 2011
    Location
    stuck inside the matrix, darn you C++
    Posts
    169
    Rep Power
    64

    Cool Maybe

    I honestly might think of making that...a GUI would be simple but setting up all those libs might get annoying

  5. #5
    zandmstudios is offline -Hacks Newbie
    Join Date
    Sep 2009
    Location
    Do ya really need to know?
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by bloodles View Post
    I honestly might think of making that...a GUI would be simple but setting up all those libs might get annoying
    Hmm, yeah, that's what I was thinking. I'm no developer, but I figured that the GUI would be the simple part...did you go to the blog post where libspotify is located? (UPDATE: the link for libspotify is right here: ) Bloodles, I really hope you (or anyone!) could do it...any developer worth his salt could easily create a simple music player GUI and then just implement libspotify...look to despotify.se for examples of third-party Spotify clients. There's already been one written in Qt for Maemo, and another for XBMC in the XBOX 360...I'm sure a PSP client couldn't be much harder...I have a premium account, so I can provide a libspotify application key (if necessary, I don't even know what it is ) to any developer willing to spend some time writing the program...thanks for replying, Bloodles

    Auto-Merge: Okay, well, I just went on the despotify website and found something interesting. Despotify (the main third-party Spotify client) has their source code up for grabs. So theoretically, you could just take that code and port it to the PSP. However, a custom GUI optimized for the PSP's hardware would be preferable...seeing as the smaller screen size and PlayStation buttons are quite different from a normal computer. Lol.

  6. #6
    bloodles's Avatar
    bloodles is offline Programmer -Hacks Smarty
    Join Date
    Jun 2011
    Location
    stuck inside the matrix, darn you C++
    Posts
    169
    Rep Power
    64

    Cool

    Alright I downloaded the latest source code...

    I think realistically and not optimistically, so to port this entire project to the psp would take a long time, and for sure one developer...
    this project uses ruby, C, python AND java, and ruby and java are not supported yet


    Just take a look at the player coded in python:
    #!/usr/bin/env python
    # vim: set fileencoding=utf-8 :
    # cambodia.py - a despotified terminal client
    #
    # License: Do not do to this code that which would anger you if others
    # did it to yours.
    #
    # Keys:
    # Up/Down/PgUp/PgDn Move focus in lists of playlists and tracks
    # Left/Right Move focus between playlists and tracks
    # Enter Play current playlist starting at focused track
    # Backspace Stop
    # Space Pause/Resume
    # Esc Quit

    import spytify

    from getpass import getpass
    import urwid
    import urwid.curses_display

    import sys

    ################################################################################
    # Tracks view
    class TrackItem(urwid.AttrWrap):
    def __init__(self, track, num):
    self.track = track

    sec = track.length / 1000
    length = '%d:%02d' % (sec / 60, sec % 60)
    if track.has_meta_data():
    widget = self.create_columns(str(num), track.title,
    '/'.join(a.name for a in track.artists),
    track.album, length)
    if not track.is_playable():
    widget = urwid.AttrWrap(widget, 'tr-na')
    else:
    widget = urwid.AttrWrap(urwid.Text('Unplayable', wrap = 'clip'), 'tr-na')

    self.__super.__init__(widget, None, 'tr-focus')

    def create_columns(id, title, artist, album, length):
    columns = [
    ('fixed', 3, urwid.Text(id, align = 'right', wrap = 'clip')),
    ('weight', 2, urwid.Text(title, wrap = 'clip')),
    ('weight', 1, urwid.Text(artist, wrap = 'clip')),
    ('weight', 1, urwid.Text(album, wrap = 'clip')),
    ('fixed', 5, urwid.Text(length, align = 'right', wrap = 'clip'))
    ]
    return urwid.Columns(columns, dividechars = 1, min_width = 4)
    create_columns = staticmethod(create_columns)

    def selectable(self):
    return True

    def keypress(self, (maxcol,), key):
    return key

    class TrackWalker(urwid.SimpleListWalker):
    def __init__(self, playlist):
    num = 1
    contents = []
    for t in playlist.tracks:
    contents.append(TrackItem(t, num))
    num += 1

    urwid.SimpleListWalker.__init__(self, contents)

    def set_focus(self, position):
    if not self:
    return

    # Highligt current track when focus leaves TracksView
    self[self.focus].set_attr('tr-normal')
    urwid.SimpleListWalker.set_focus(self, position)
    self[self.focus].set_attr('tr-selected')

    class TracksView(urwid.Frame):
    def __init__(self, playlist, session):
    self.playlist = playlist
    self.session = session

    header = urwid.AttrWrap(TrackItem.create_columns('#', 'Title', 'Artist',
    'Album', 'Len.'), 'tr-header')
    footer = urwid.AttrWrap(urwid.Text('"%s" by %s, %d tracks' %
    (playlist.name, playlist.author, len(playlist.tracks)),
    align = 'center', wrap = 'clip'), 'tr-footer')
    tracks = urwid.ListBox(TrackWalker(playlist))
    self.__super.__init__(tracks, header = header, footer = footer)
    tracks.set_focus(0)

    def keypress(self, (maxcol, maxrow), key):
    key = self.get_body().keypress((maxcol, maxrow-2), key)
    if key == 'enter':
    item,pos = self.get_body().get_focus()
    if item:
    self.session.play(self.playlist, item.track)
    else:
    return key

    ################################################################################
    # Playlist view
    class PlaylistItem(urwid.AttrWrap):
    def __init__(self, playlist, session):
    self.playlist = playlist
    widget = urwid.Text(playlist.name, wrap = 'clip')
    self.__super.__init__(widget, None, 'pl-focus')

    self.tracks_view = TracksView(playlist, session)

    def selectable(self):
    return True

    def keypress(self, (maxcol,), key):
    return key

    class PlaylistWalker(urwid.SimpleListWalker):
    def __init__(self, session, tracks_container):
    self.tracks_container = tracks_container

    contents = []
    for p in session.playlists:
    contents.append(PlaylistItem(p, session))

    urwid.SimpleListWalker.__init__(self, contents)

    def set_focus(self, position):
    if not self:
    return

    # Highligt current playlist when focus leaves PlaylistsView
    self[self.focus].set_attr('pl-normal')
    urwid.SimpleListWalker.set_focus(self, position)
    self[self.focus].set_attr('pl-selected')

    # Display TracksView
    self.tracks_container.set_w(self[self.focus].tracks_view)

    class PlaylistsView(urwid.ListBox):
    def __init__(self, session, tracks_container):
    self.playlists = PlaylistWalker(session, tracks_container)
    self.__super.__init__(self.playlists)
    self.set_focus(0)

    ################################################################################
    # Browse view
    class BrowseView(urwid.Columns):
    def __init__(self, session):
    dummy = urwid.Filler(urwid.Text(
    'No playlists found. Press "escape" to quit.', align = 'center'))
    tracks_container = urwid.WidgetWrap(dummy)
    playlists = PlaylistsView(session, tracks_container)
    self.__super.__init__([('fixed', 15, playlists), tracks_container], 1, 0)

    ################################################################################
    # Player view
    class PlayerView(urwid.Pile):
    def __init__(self, session):
    self.session = session
    self.status = urwid.Text('Stopped')
    self.__super.__init__([urwid.Divider('─'), self.status])

    def selectable(self):
    return False

    ################################################################################
    # Root view
    class RootView(urwid.Frame):
    def __init__(self, session):
    header = urwid.AttrWrap(urwid.Text('♪ Cambodia ♪',
    align = 'center', wrap = 'clip'), 'header')
    player = PlayerView(session)
    browser = BrowseView(session)
    self.__super.__init__(browser, header = header, footer = player)

    ################################################################################
    # Spotify session
    class SpotifySession(spytify.Spytify):
    def __init__(self, username, password):
    self.username = username
    self.logged_in = False
    self.started = False
    self.playing = False

    print 'Connecting...'
    self.session = spytify.Spytify(username, password)

    self.logged_in = True

    print 'Loading playlists...'
    self.playlists = self.session.stored_playlists
    if not self.playlists:
    self.playlists = []

    #print 'Searching...'
    #testlist = self.session.search('album:"SimCity 3000"')
    #if testlist:
    # self.playlists.insert(0, testlist)

    def __del__(self):
    if self.logged_in:
    print 'Disconnecting...'
    self.session.close()

    def toggle_playback(self):
    if self.playing:
    self.session.pause()
    playing = False
    elif self.started:
    self.session.resume()
    playing = True

    def play(self, playlist, track):
    self.session.play_list(playlist, track)
    self.started = True
    self.playing = True

    def stop(self):
    self.started = False
    self.playing = False

    ################################################################################
    # Manager
    class Manager:
    def main(self, username, password):
    try:
    self.session = SpotifySession(username, password)

    print 'All good, running GUI...'
    self.view = RootView(self.session)

    self.ui = urwid.curses_display.Screen()
    self.ui.register_palette([
    ('header', 'white', 'black', 'bold'),
    # Playlist
    ('pl-normal', 'default', 'default'),
    ('pl-focus', 'black', 'light gray', 'standout'),
    ('pl-selected', 'white', 'black', 'bold'),
    # Tracks
    ('tr-header', 'dark gray', 'default', 'bold'),
    ('tr-footer', 'dark gray', 'default'),
    ('tr-normal', 'default', 'default'),
    ('tr-focus', 'black', 'light gray', 'standout'),
    ('tr-selected', 'white', 'black', 'bold'),
    ('tr-na', 'dark red', 'default'),
    ])
    self.ui.run_wrapper(self.run)

    except spytify.SpytifyError:
    print >>sys.stderr, 'Ouch, Spotify error: "', sys.exc_value, '"'
    return 1

    return 0

    def run(self):
    self.size = self.ui.get_cols_rows()

    self.done = False
    while not self.done:
    canvas = self.view.render(self.size, focus=True)
    self.ui.draw_screen(self.size, canvas)
    while True:
    keys = self.ui.get_input()
    if keys:
    self.handle_input(keys)
    break;

    def handle_input(self, keys):
    for k in keys:
    if k == 'esc':
    self.done = True
    elif k == 'window resize':
    self.size = self.ui.get_cols_rows()
    else:
    k = self.view.keypress(self.size, k)

    # FIXME: These doesn't actually work.
    if k == 'space':
    self.session.toggle_playback()
    elif k == 'backspace':
    self.session.stop()

    if __name__ == '__main__':
    username = raw_input("Enter your username: ").strip()

    if not username:
    print >>sys.stderr, "Empty username, exiting."
    sys.exit(1)

    password = getpass("Enter your password: ").strip()
    if not password:
    print >>sys.stderr, "Empty password, exiting."
    sys.exit(1)

    sys.exit(Manager().main(username, password))
    ^that would take some time to port


    I will see what I can do, if any other dev wants to pitch in I'd gladly accept, JUST MESSAGE ME

  7. #7
    zandmstudios is offline -Hacks Newbie
    Join Date
    Sep 2009
    Location
    Do ya really need to know?
    Posts
    7
    Rep Power
    0

    Default

    Hey, thanks, Bloodles, for taking the time to read my (rather uneducated ^_^) posts and making an effort for this project. Now, a couple things: A) should this thread be moved to PSP Programming and Development now? B) are you (Bloodles) a Spotify user yourself? Haha because I don't want you to be spending time porting a project that you wouldn't even be able to use and C) I think this project could really be something big, because currently, the only ways to listen to music on-demand on the PSP are to either 1) download your own mp3's/other audio files to the PSP and listen to them there, 2) stream your downloaded songs from your computer using messy server software, or 3) get a Music Unlimited Qriocity subscription, which really isn't worth it considering the limited song catalog and platforms available. A Spotify client for PSP would really change things up, as it would completely change the way people could use their PSP's and create a new idea for a new market in the PS Vita. That is, multimedia offerings. This type of stuff could be what gives the PlayStation brand the edge over other brands offering multimedia, gaming, and social services (ahem, Apple).

    With all that said, DEVS, PLEASE GET ON BOARD WITH THIS! DON'T LEAVE BLOODLES ALL ON HIS OWN PORTING THIS BIG PROJECT! And sorry for the caps but I wanted your attention. Ha. Once again, thank you Bloodles for your contributions and efforts. If there's anything I can do (like testing!) just PM or email me (my email address is zandmstudios@gmail.com).

  8. #8
    bloodles's Avatar
    bloodles is offline Programmer -Hacks Smarty
    Join Date
    Jun 2011
    Location
    stuck inside the matrix, darn you C++
    Posts
    169
    Rep Power
    64

    Default

    sorry for the late response I've been very busy lately

    A) Yes, now would be a good time

    B) No im not a spotify member, but I might decide to. No worries, this interests me, so im down with coding it..

    C) Yeah I agree with you, this would change a lot of things, but again I must stress that there needs to be multiple developers
    (I plan to just code part of it and release it so another dev can pick it up)

  9. #9
    zandmstudios is offline -Hacks Newbie
    Join Date
    Sep 2009
    Location
    Do ya really need to know?
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by bloodles View Post
    sorry for the late response I've been very busy lately

    A) Yes, now would be a good time

    B) No im not a spotify member, but I might decide to. No worries, this interests me, so im down with coding it..

    C) Yeah I agree with you, this would change a lot of things, but again I must stress that there needs to be multiple developers
    (I plan to just code part of it and release it so another dev can pick it up)
    The late response is fine, I can understand being busy but okay, everything sounds good so far, just two things: A) I'm a newcomer to the --Hacks forum, so how do I change this thread to PSP Programming and Development? Or do I have to recreate it in that subforum? And B) we really need more devs. Lol.

  10. #10
    bloodles's Avatar
    bloodles is offline Programmer -Hacks Smarty
    Join Date
    Jun 2011
    Location
    stuck inside the matrix, darn you C++
    Posts
    169
    Rep Power
    64

    Default

    I really have no clue just ask around and maybe someone can tell you

Page 1 of 2 1 2 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •