Giter Club home page Giter Club logo

orochi's Introduction

Orochi – 8tracks.com client

Build status PyPI version PyPI Python versions PyPI license PyPI wheel PyPI downloads per month Bounties

Orochi is a command line client for 8tracks.com written in Python.

Yamata no Orochi (八岐の大蛇) is a legendary 8-headed and 8-tailed Japanese dragon. The name translates to "8-branched giant snake". I chose the name because it both refers to the number eight (as in 8tracks) and to snakes (as in Python).

Illustration of Yamata no Orochi

Image courtesy of Gustavo Araujo

Installing

Using pip:

$ sudo pip install -U orochi

If you're an ArchLinux user, you can also install orochi or orochi-git from AUR:

$ yaourt -S orochi

Usage

Prerequisites:

  • Python 2.7+ and 3.3+
  • mplayer (at least r27665, released in 1.0rc3)

Start:

$ orochi

Available commands (main menu):

search:
    Syntax: search <searchterm>
    Search for a mix by keyword.
    You can then play a mix with the "play" command.
    Press enter to show next page results.
search_tags:
    Syntax: search <tag1>, <tag2>
    Search for a mix by tag(s), separated by comma.
    You can then play a mix with the "play" command.
    Press Enter to show next page results.
search_user:
    Syntax: search <username>
    Search for a mix by user.
    You can then play a mix with the "play" command.
    Press Enter to show next page results.
search_user_liked:
    Syntax: search <username>
    Search for a mix liked by user.
    You can then play a mix with the "play" command.
    Press Enter to show next page results.
set:
    Syntax: set <setting> <param>
    Configure settings.
    Available settings:
    - autologin yes|no
      Toggle autologin on start (no by default)
      WARNING: password will be saved in plain text.
    - sorting recent|popular|hot (hot by default)
      Configure search results sorting order.
    - results_per_page <n>
      Set number of results per page showed.
    - terminal_title yes|no (yes by default)
      Toggle setting terminal title to song status.
    - log_current_song yes|no (no by default)
      Toggle whether to log current song information
      to file `~/.cache/orochi/current_song.txt`
    To get help for each setting, press Enter with no <param>.
play:
    Syntax: play <mix>
    Play the nth mix from the last search results.
    The <mix> argument can also be a mix ID or an URL.
exit:
    Exit the interpreter.
    You can also use the Ctrl-D shortcut.
login:
    Syntax: login <username>
    Log in to your 8tracks account.
liked_mixes:
    List liked mixes (login required).
    Press Enter to show next page results.

Available commands (play mode menu):

pause / p:
    Pause or resume the playback.
stop:
    Stop the playback and exit play mode.
next_song / n:
    Skip to next song.
next_mix:
    Skip to next mix.
status / s:
    Show the status of the currently playing song.
mix_info:
    Show information about the currently playing mix.
volume / v:
    Syntax: volume <amount>
    Change playback volume. The argument must be a number between 0 and 100.
like_mix / l:
    Like the currently playing mix (login required).
unlike_mix / ul:
    Un-like the currently playing mix (login required).
fav_track / f:
    Favorite the currently playing track (login required).
unfav_track / uf:
    Un-favorite the currently playing track (login required).

Configuration

The first time Orochi is started, it creates the config.json configfile in the ~/.config/orochi/ directory. The following configurations can be changed:

mplayer_extra_args:
    Extra arguments that are passed on to the mplayer instance.

Example configuration:

{
    "mplayer_extra_args": "-ao alsa:device=hw=1.0"
}

Development

Install requirements.txt (with pip install -r). Then start orochi the following way:

$ python -m orochi.client

For development and testing purposes, you can also pass in the --pdb argument. Then a debug session should be started if orochi crashes.

Coding Guidelines

PEP8 via flake8 with max-line-width set to 99 and E126-E128 ignored.

Testing

Install requirements-dev.txt, then run py.test in the main directory. Violations of the coding guidelines above will be counted as test fails.

Contributing

Please refer to the Contributors Guidelines. Thanks!

License

Copyright (C) 2013–2016 Danilo Bargen and contributors

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

orochi's People

Contributors

bshillingford avatar dbrgn avatar mindstorms6 avatar octogene avatar quigybo avatar wazari972 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orochi's Issues

Enhancement - Allow replay of mix

After a mix was done and orochi changed to the next mix I wanted to play the previous mix again, however, it will only play the last song of the that selected mix(the one that was already played). Even after a restart and re-login. This also happens to be the case if I replay another mix that was maybe played earlier in the day. I did notice that 8tracks requires you to explicitly "restart" mix so that it will re-mix. From reading the API it seems that

Play tokens are scoped around a single user for unlimited mix playback. To create a new play token call:

So possibly a new token would need to be created for this to work? http://8tracks.com/developers/api_v3#play_mixes

Apologies, if this exists already. I have only checked the help and issue queue so far.

And thanks all for your guys work this is a very awesome client!

Thanks,

Jonathan

Allow login

Login and related features:

  • User authentication
  • Favorite tracks
  • Favorite playlists
  • List favorite playlists

Search limited to 10 results

I hope I'm not flooding you here :) It may be that this is planned for the future but right now results are limited to 10, if you search a username that has more than 10 mixes you can't access any beyond the first 10.

UnicodeEncodeError

Now playing Cumbianauts Incoming by Cumbia Cosmonauts from the album Cumbia Bestial! (2010).
(8tracks:Llévame al infinito)> 
Reporting song...
(8tracks:Llévame al infinito)> fav_track
Track favorited.
Traceback (most recent call last):
  File "/usr/bin/orochi", line 9, in <module>
    load_entry_point('orochi==0.0.1', 'console_scripts', 'orochi')()
  File "/home/danilo/Projects/orochi/orochi/client.py", line 730, in main
    client.cmdloop()
  File "/home/danilo/Projects/orochi/orochi/client.py", line 167, in cmdloop
    super(Client, self).cmdloop()
  File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "/home/danilo/Projects/orochi/orochi/client.py", line 360, in do_play
    i.cmdloop()
  File "/home/danilo/Projects/orochi/orochi/client.py", line 491, in cmdloop
    super(PlayCommand, self).cmdloop()
  File "/usr/lib/python2.7/cmd.py", line 130, in cmdloop
    line = raw_input(self.prompt)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 11: ordinal not in range(128)

Refactor configuration

Things like the defaults should be handled by the ConfigFile class, not by code using it.

Fatal mplayer crashes

This issue might be related to #16.

On my Arch Linux system, I haven't been able to get even one song playing through orochi as of yet. Everytime I try to load a playlist, mplayer seems to crash. Please find the stack trace available on the console:

Traceback (most recent call last):
File "/usr/bin/orochi", line 9, in
load_entry_point('orochi==0.0.1', 'console_scripts', 'orochi')()
File "/usr/lib/python2.7/site-packages/orochi/client.py", line 431, in main
client.cmdloop()
File "/usr/lib/python2.7/site-packages/orochi/client.py", line 144, in cmdloop
super(Client, self).cmdloop()
File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "/usr/lib/python2.7/site-packages/orochi/client.py", line 219, in do_play
i = PlayCommand(self.config, mix_id, self)
File "/usr/lib/python2.7/site-packages/orochi/client.py", line 249, in init
self.p.load(self.status['track']['url'])
File "/usr/lib/python2.7/site-packages/orochi/player.py", line 145, in load
"Something must have gone wrong.", self.p.readerr())
File "/usr/lib/python2.7/site-packages/orochi/player.py", line 31, in getattr
raise TerminatedException('MPlayer has been terminated and cannot be used anymore.')
orochi.player.TerminatedException: MPlayer has been terminated and cannot be used anymore.

It looks like a network issue. It could be. But on my ElementaryOS, I usually get about 2-3 songs playing before this issue pops up.

I used to have mplayer2 on my Arch System, figured that could be the issue and replaced it back with mplayer. But the problem persists. Do let me know if I can provide more information / debugging.

US/Canada Based Maintainer Needed

8tracks are essentially blocking out all non-US and non-Canadian users starting today:

http://blog.8tracks.com/2016/02/12/a-change-in-our-international-streaming/

I asked whether this affects people based on their IP. It does:

Yes, unfortunately this requires GeoIP blocking, as you mentioned, which means that content to all apps outside the US & Canada will be blocked. The YouTube streaming is a web integration using YT's API to call the same files that are included in an 8tracks playlist to stream from their servers when available.

This means that starting today, Orochi will cease to work outside the US or Canada.

8tracks started out as a likeable, very "different" streaming company. Their legal basis was that they could operate as an online radio by imposing some limits on playlists and playback. It worked out great. They had a great app, a great website and friendly support staff. But it seems that politics and copyright / money have gotten in the way.

The following paragraph is part of their blogpost:

We remain committed to bringing 8tracks to a global audience so all can join us in creating and discovering playlists for every taste, time and place.

To me, that's just empty marketing-speech. We need less barriers in the internet, not more! Country boarders should not interfere with the usage of the net.


TLDR: If you're based in the US or in Canada and want to continue the development of Orochi, please let me know! I don't feel like investing more time into this project.

Move to Twisted?

The current way Orochi works is not ideal. There are several background threads, a cmd loop for the input and other things I don't like too much.

Maybe we should move to an event based solution like Twisted, Tornado or Gevent?

Does someone have experience with these libraries? Would that work well?

List dependency on mplayer

As it currently is I did not see any mention that mplayer was required until I attempted to play a selection, just thought I'd point this out.

"403 Forbidden" response crashes orochi

E.g. I tried to play the "Fields of Heather" mix from Austria and got the following response:

*** HTTP Error: (u'403 Client Error: Forbidden for url: https://8tracks.com/sets/536722025/play.json?mix_id=8345975', {u'status': u'403 Forbidden', u'notices': u'Due to international streaming restrictions, this playlist may have limited playback in your region.', u'errors': [u'Due to international streaming restrictions, this playlist may have limited playback in your region.'], u'api_version': 2, u'logged_in': False})

Which sucks but is to be expected. However orochi crashes on this, I think it should handle this response gracefully instead. I guess it should just print an error message (possibly just pass through the one from 8tracks) and not play the offending playlist.

Have a traceback for completeness' sake:

Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/thomas/repos/external/orochi/orochi/client.py", line 872, in <module>
    main()
  File "/home/thomas/repos/external/orochi/orochi/client.py", line 862, in main
    client.cmdloop()
  File "/home/thomas/repos/external/orochi/orochi/client.py", line 216, in cmdloop
    super(Client, self).cmdloop()
  File "/usr/lib64/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib64/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "/home/thomas/repos/external/orochi/orochi/client.py", line 434, in do_play
    i.prompt = get_prompt(mix)
UnboundLocalError: local variable 'i' referenced before assignment

Playlist does not advance to next song after a song is finished

EDIT

This is related to the following bug (https://bugs.launchpad.net/ubuntu/+source/mplayer2/+bug/1191259). Ubuntu installed mplayer2 instead of mplayer and as a result this bug came up. I removed mplayer2 and installed mplayer and everything is fine now. I'm sorry for the possible confusion!


Hello,

I recently updated to Ubuntu 13.10 and I discovered that the player does not automatically advance to the next song after a song is finished. If I understand the code correctly, the player checks for every 0.5 seconds to see if 30 seconds have passed to report the song to the server. Also, it checks if mplayer returned the GLOBAL: EOF code: 1 and calls the PlayCommand._song_end_handler, but that function is sometimes never called. Perhaps something has changed in the way mplayer works? My mplayer version is:

$ apt-cache show mplayer | grep -i version
Version: 2:1.0~rc4.dfsg1+svn34540-1ubuntu4

Here is what this part looks like now (line 163 in player.py):

while not stop_event.is_set():
    if not reported:
        with write_lock:
            process.write('{} get_time_pos\n'.format(pausing_keep))
    stdout = process.read()
    if stdout:
        if 'GLOBAL: EOF code: 1' in stdout:
            os.kill(os.getpid(), signal.SIGUSR1)
        if not reported:
            match = time_pos_rex.search(stdout)
            if match and float(match.group(1)) >= 30:
                os.kill(os.getpid(), signal.SIGUSR2)
                reported = True
    stop_event.wait(0.5)

and this is what I've changed it to:

while not stop_event.is_set():
    with write_lock:
        process.write('{} get_time_pos\n'.format(pausing_keep))
    stdout = process.read()
    if stdout:
        if 'GLOBAL: EOF code: 1' in stdout:
             os.kill(os.getpid(), signal.SIGUSR1)
             break
        match = time_pos_rex.search(stdout)
        if match:
            pos = float(match.group(1))
            if pos == lastpos:
                os.kill(os.getpid(), signal.SIGUSR1)
                break
            lastpos = pos 
            if not reported and pos >= 30:
                os.kill(os.getpid(), signal.SIGUSR2)
                reported = True
    stop_event.wait(0.5)

I've added the check if the last position is the same as the current position, and from that I can conclude that the playback has stopped. This adds another issue - the player thinks that it should skip to the next song when it's paused.

Is there a better solution to this problem? Has anybody else experienced this?

Some time mplayer fails

Using Fedora 18 with master orochi.

Here is the log:

Skipping track...
Traceback (most recent call last):
File "/bin/orochi", line 9, in
load_entry_point('orochi==0.0.1', 'console_scripts', 'orochi')()
File "/usr/lib/python2.7/site-packages/orochi-0.0.1-py2.7.egg/orochi/client.py", line 733, in main
client.cmdloop()
File "/usr/lib/python2.7/site-packages/orochi-0.0.1-py2.7.egg/orochi/client.py", line 168, in cmdloop
super(Client, self).cmdloop()
File "/usr/lib64/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib64/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "/usr/lib/python2.7/site-packages/orochi-0.0.1-py2.7.egg/orochi/client.py", line 363, in do_play
i.cmdloop()
File "/usr/lib/python2.7/site-packages/orochi-0.0.1-py2.7.egg/orochi/client.py", line 494, in cmdloop
super(PlayCommand, self).cmdloop()
File "/usr/lib64/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib64/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "/usr/lib/python2.7/site-packages/orochi-0.0.1-py2.7.egg/orochi/client.py", line 683, in do_n
self.do_next_song(_args, *_kwargs)
File "/usr/lib/python2.7/site-packages/orochi-0.0.1-py2.7.egg/orochi/client.py", line 569, in do_next_song
self.p.load(self.status['track']['url'])
File "/usr/lib/python2.7/site-packages/orochi-0.0.1-py2.7.egg/orochi/player.py", line 139, in load
self._send_command('loadfile {}', path)
File "/usr/lib/python2.7/site-packages/orochi-0.0.1-py2.7.egg/orochi/player.py", line 113, in _send_command
self.p.write(command.format(*safe_args) + '\n')
File "/usr/lib/python2.7/site-packages/orochi-0.0.1-py2.7.egg/orochi/player.py", line 27, in getattr
raise TerminatedError('MPlayer has been terminated and cannot be used anymore.')
orochi.errors.TerminatedError: MPlayer has been terminated and cannot be used anymore.

Passing arguments

Hi,

I'd like to automate orochi so that I start it with something like
orochi "http://8tracks.com/sofsotosugar/happy-mix"
This should then start playback right away. Is it already possible to do that?

cheers!

Handle SIGINT

When in playback mode, interpret SIGINT as "stop".

Zombie mplayer processes left after crash

After experiencing a few crashes, I ran pgrep mplayer and noticed several
mplayer processes left running. These should be caught and killed before
orochi exits, even after a crash.

Playback fails randomly

When I try to play some mixes, there is a 'do you experience network problems' error, but my Internet works just fine. It's just that some playlists (and there are a lot) won't be played and others will. How can I help you find this bug?? Are there any reports or logs I can find and file?

UnicodeEncodeError

(8tracks:Worldwide Rythm)> 
Song has ended!
Playlist has ended!
Skipping to the next mix...
Now playing Vampire (feat. Whiteboy John) by Tribal Seeds from the album The Harvest.
(8tracks:De¢ember 2012)> 
Reporting song...
(8tracks:De¢ember 2012)> p
Traceback (most recent call last):
  File "/usr/bin/orochi", line 9, in <module>
    load_entry_point('orochi==0.0.1', 'console_scripts', 'orochi')()
  File "/home/danilo/Projects/orochi/orochi/client.py", line 733, in main
    client.cmdloop()
  File "/home/danilo/Projects/orochi/orochi/client.py", line 168, in cmdloop
    super(Client, self).cmdloop()
  File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "/home/danilo/Projects/orochi/orochi/client.py", line 363, in do_play
    i.cmdloop()
  File "/home/danilo/Projects/orochi/orochi/client.py", line 494, in cmdloop
    super(PlayCommand, self).cmdloop()
  File "/usr/lib/python2.7/cmd.py", line 130, in cmdloop
    line = raw_input(self.prompt)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa2' in position 11: ordinal not in range(128)

The `play` command does not pick the correct playlist after a tag search.

After performing a tag search, the play n command plays a playlist that is not listed in the latest search result. It is supposed to play a playlist chosen by its corresponding number.

Example output:

(8tracks)> search_tags chillwave, electronic
Results for "chillwave, electronic":
 1)  seven wonders (9 tracks, 0h 29m, by joawia)
     Tags: happy, chillwave, odesza, electronic, majestic casual
 2)  Echoes (8 tracks, 0h 24m, by sziaszia)
     Tags: chillwave, instrumental, 3am, misc, indie electronic
 3)  chillin like a villain (17 tracks, 0h 5m, by alienvxbes)
     Tags: chillwave, chill, electronic, relax, chillstep
 4)  Beam (9 tracks, 0h 33m, by Simple Matters)
     Tags: chillwave, chill vibes, electronic, mellow, feel good
 5)   girls born in the 90’s are dangerous (11 tracks, 0h 34m, by the-glamorous)
     Tags: chill, chillwave, tumblr, electronic, trap
 6)  I'm cool (39 tracks, 2h 13m, by loisbang)
     Tags: indie rock, alt rock, chillwave, indie, electronic
 7)  reverie (9 tracks, 0h 32m, by Hensin)
     Tags: chill, electronic, chillwave, vaporwave, aesthetic
 8)  Illusions (11 tracks, 0h 34m, by Simple Matters)
     Tags: neo-soul, chillwave, electronic, study, feel good vibes
 9)  Rebirthロ (11 tracks, 0h 44m, by PetScoliosis)
     Tags: synthpop, dreampop, chillwave, electronic, alternative
 10) ethereal (9 tracks, 0h 13m, by aoifeey)
     Tags: electronic, chill, chillwave, ambient, relax
Page 1 on 431. --Next-- (Enter)
(8tracks)> play 7
Now playing Bubble Bath by kev. from the album EDM.com Free Downloads.

Permission denied for .config/orochi/config.json

Running orochi results in this error:

$ cd ~/Programs/orochi; python -m orochi.client
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/gtisza/Programs/orochi/orochi/client.py", line 734, in <module>
    main()
  File "/home/gtisza/Programs/orochi/orochi/client.py", line 731, in main
    client.cmdloop()
  File "/home/gtisza/Programs/orochi/orochi/client.py", line 168, in cmdloop
    super(Client, self).cmdloop()
  File "/usr/lib/python2.7/cmd.py", line 109, in cmdloop
    self.preloop()
  File "/home/gtisza/Programs/orochi/orochi/client.py", line 136, in preloop
    self.config = ConfigFile()
  File "/home/gtisza/Programs/orochi/orochi/client.py", line 72, in __init__
    with open(self.filename, 'r') as configfile:
IOError: [Errno 13] Permission denied: u'/home/gtisza/.config/orochi/config.json'
$ ls -l /home/gtisza/.config/orochi/config.json
---x-wx-wT 1 gtisza gtisza 146 Sep 23 19:13 /home/gtisza/.config/orochi/config.json

After changing the file permissions to 666, orochi runs as expected.

License Issues

I just found out about Orochi through the SuperUser Question that seems to have prompted this.

The License file states that the copyright lies with The Free Software Foundation. I'm assuming you simply copied the LICENSE file from a similar FSF-assigned source. But unless you are interested in handing over all your copyrights to the FSF, you mught want to remove that part.

Copyright assignment is something done by all the GNU Projects so that the FSF may take care of the legalities. I have only some idea in this domain, but feel free to contact me, I can hook you up with people with more legal knowledge for the nitty gritties.

Debug when playing song crashes program

While in play mode if you type debug it crashes with the following:
I suggest allowing for some type of crashdump etc so we can help provide you with feedback when crashes occur.

(8tracks:504742)> debug
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/pi/orochi/orochi/client.py", line 221, in <module>
    client.cmdloop()
  File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "/home/pi/orochi/orochi/client.py", line 89, in do_play
    i.cmdloop()
  File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "/home/pi/orochi/orochi/client.py", line 210, in do_debug
    import ipdb; ipdb.set_trace()
ImportError: No module named ipdb
Exception SystemError: SystemError('error return without exception set',) in <bound    method MPlayer.__del__ of <orochi.player.MPlayer object at 0xb66323b0>> ignored

Hope this helps

Allow external control

Could be used e.g. for multimedia keys using xbindkeys.

I'm not sure yet what the best way to implement this would be.

Enhancement - Ability to play via url

If the url is known it would be nice to be able to skip the search and play directly, this might also allow for easier integration with possible future front ends.

Additionally the ability to save url's and build a playlist would also be nice, however a previous bug mentions the ability to provide log in credtials which I assume would give access to liked playlists already.

Leave player mode once playlist has ended

Trying to issue the stop command after a playlist has ended raises a
TerminatedException. It makes more sense to just leave the player mode
once the playlist has ended.

AttributeError: 'Client' object has no attribute '_results_per_page'

Traceback (most recent call last):
  File "/Users/rotemy/.virtualenv/bin/orochi", line 11, in <module>
    sys.exit(main())
  File "/Users/rotemy/.virtualenv/lib/python2.7/site-packages/orochi/client.py", line 732, in main
    client.cmdloop()
  File "/Users/rotemy/.virtualenv/lib/python2.7/site-packages/orochi/client.py", line 169, in cmdloop
    super(Client, self).cmdloop()
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cmd.py", line 221, in onecmd
    return func(arg)
  File "/Users/rotemy/.virtualenv/lib/python2.7/site-packages/orochi/client.py", line 406, in do_liked_mixes
    self.do_search_user_liked(self._user_name)
  File "/Users/rotemy/.virtualenv/lib/python2.7/site-packages/orochi/client.py", line 250, in do_search_user_liked
    mixes = self.search_request(s, 'user_liked')
  File "/Users/rotemy/.virtualenv/lib/python2.7/site-packages/orochi/client.py", line 423, in search_request
    self.config['results_sorting'], self._search_results_page, self._results_per_page)
AttributeError: 'Client' object has no attribute '_results_per_page'

Pausing

Apparently it's not possible to pause before the song has been reported.

app crashes after running search_tags

Orochi crashes by running the search_tags command under python3.5 and python2.7 under debian.

`(8tracks)> search_tags rock
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/requests/utils.py", line 796, in check_header_validity
if not pat.match(value):
TypeError: expected string or bytes-like object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/orochi", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/orochi/client.py", line 862, in main
client.cmdloop()
File "/usr/local/lib/python3.5/dist-packages/orochi/client.py", line 216, in cmdloop
super(Client, self).cmdloop()
File "/usr/lib/python3.5/cmd.py", line 138, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python3.5/cmd.py", line 217, in onecmd
return func(arg)
File "/usr/local/lib/python3.5/dist-packages/orochi/client.py", line 268, in do_search_tags
mixes = self.search_request(s, 'tag')
File "/usr/local/lib/python3.5/dist-packages/orochi/client.py", line 500, in search_request
self.config['results_sorting'], self._search_results_page, self._results_per_page)
File "/usr/local/lib/python3.5/dist-packages/orochi/api.py", line 176, in search_mix
data = self._get(resource, params)
File "/usr/local/lib/python3.5/dist-packages/orochi/api.py", line 60, in _get
r = self.s.get(self.base_url + resource, params=params, *_kwargs)
File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 488, in get
return self.request('GET', url, *_kwargs)
File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 461, in request
prep = self.prepare_request(req)
File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 394, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 295, in prepare
self.prepare_headers(headers)
File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 409, in prepare_headers
check_header_validity(header)
File "/usr/local/lib/python3.5/dist-packages/requests/utils.py", line 800, in check_header_validity
"not %s" % (value, type(value)))
requests.exceptions.InvalidHeader: Header value 2 must be of type str or bytes, not <class 'int'>
`

next_song at end of playlist doesn't stop the song

When using next_song to skip a song and that song is the last song in the playlist, the playback isn't stopped.

(8tracks:Worldwide Rythm)> next_song
Playlist has ended!
(8tracks)> 
Reporting song...
(8tracks:Worldwide Rythm)> 

Release v0.1.0

I think Orochi is almost ready for a first release on PyPI.

Login won't be included in the first version.

Are there any important issues we should cover before the release? Maybe #10?

cc @quigybo @mindstorms6

Unable to specify mplayer device output

If a user has multiple outputs, for example hw 0,0 being and analog jack, and also has a USB DAC on hw 1,0 there is no way to specify which to use and it appears the default 0,0 is used.

I suggest either a means of selecting this within the program (preferred) or by means of a configuration file with an optional line to pass daemon arguments for mplayer (example mplayer -ao alsa:device=hw=1.0)

Continuous playback

The music should never stop!

Once one playlist has ended, the next mix in the set should
automatically start. Pull request #12 adds bindings for the next_mix
method, and Issue #13 needs to be resolved first.

Then maybe a boolean config key for continuous play that can be toggled
via a command in the client? Thoughts?

"Show URL" command

Add a command called url, show_url or similar to show the URL of the currently playing mix.

Add collections

Please add a possibility to play your collections. This would be really awesome!

"AttributeError: 'NoneType' object has no attribute 'peer_certificate'" on track switch

I get this after a song has ended. I can manually skip to the next song but if a song ends I have to restart the client.

Here is the full trace. This is on cygwin 64-bit:

(8tracks:summer 14')>
Song has ended!
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in run_code
exec code in run_globals
File "/home/***
/orochi/orochi/client.py", line 734, in
main()
File "/home/**__/orochi/orochi/client.py", line 731, in main
client.cmdloop()
File "/home/
_/orochi/orochi/client.py", line 168, in cmdloop
super(Client, self).cmdloop()
File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "/usr/lib/python2.7/cmd.py", line 221, in onecmd
return func(arg)
File "/home/
/orochi/orochi/client.py", line 363, in do_play
i.cmdloop()
File "/home/**/orochi/orochi/client.py", line 492, in cmdloop
super(PlayCommand, self).cmdloop()
File "/usr/lib/python2.7/cmd.py", line 130, in cmdloop
line = raw_input(self.prompt)
File "/home/**
/orochi/orochi/client.py", line 511, in _song_end_handler
self.status = self.api.next_track(self.mix_id)
File "orochi/api.py", line 261, in next_track
return self._playback_control(mix_id, 'next')
File "orochi/api.py", line 231, in _playback_control
'mix_id': mix_id,
File "orochi/api.py", line 58, in _get
r = self.s.get(self.base_url + resource, params=params, *_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 347, in get
return self.request('GET', url, *_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 335, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 438, in send
r = adapter.send(request, *_kwargs)
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 292, in send
timeout=timeout
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 428, in urlopen
body=body, headers=headers)
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 280, in _make_request
conn.request(method, url, *_httplib_request_kw)
File "/usr/lib/python2.7/httplib.py", line 973, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.7/httplib.py", line 1007, in _send_request
self.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 969, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 829, in _send_output
self.send(msg)
File "/usr/lib/python2.7/httplib.py", line 791, in send
self.connect()
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 114, in connect
match_hostname(self.sock.getpeercert(),
File "/usr/lib/python2.7/ssl.py", line 181, in getpeercert
return self._sslobj.peer_certificate(binary_form)
AttributeError: 'NoneType' object has no attribute 'peer_certificate'

Naming of skip / next_mix

Currently the naming of skip and next_mix commands is inconsistent. Consistent would be next_mix and next_song or skip_song and skip_mix. But that is also longer and more tedious to type.

Another approach would be to use "shortcuts" as aliases for the longer names, e.g. skip -> skip_song and vol -> volume.

Any thoughts on this? @quigybo maybe?

Some playlists only play one song when logged in

When I'm logged in certain playlists will only play one song.

It is always the same song, and attempting to skip it results in "Playlist has ended!". Removing the config file fixes this, but as soon as I am logged in again the problem returns.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.