diff --git a/.travis.yml b/.travis.yml index a013b34..6786e71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,15 @@ -group: travis_latest +dist: trusty +sudo: required language: python cache: pip python: - - 3.6 -install: - - pip install flake8 # pytest # add another testing frameworks later -before_script: - # stop the build if there are Python syntax errors or undefined names - - flake8 . --count --select=E501,E9,F821,F822,F823,W191 --show-source --statistics - # exit-zero treats all errors as warnings. - - flake8 . --count --exit-zero --max-complexity=10 --statistics -script: - - true # pytest --capture=sys # add other tests here -notifications: - on_success: change - on_failure: change # `always` will be the setting once code changes slow down + - "3.5" + - "3.6" + - "3.7" +before_install: + - sudo apt-get update + - sudo apt-get install -y libmpv1 + - pip install pyflakes + - pyflakes . +install: pip install . +script: comp -v \ No newline at end of file diff --git a/README.rst b/README.rst index f3cf300..6bfd882 100644 --- a/README.rst +++ b/README.rst @@ -262,7 +262,7 @@ Configuration files ------------------- If not specified by the ``--config``, (user-specific) configuration file is -``~/.config/mpv/settings.ini``. Default configurations +``~/.config/comp/settings.ini``. Default configurations are listed below:: [comp] @@ -285,7 +285,7 @@ are listed below:: [youtube-dl] # Video format/quality to be passed to youtube-dl. See FORMAT SELECTION in # youtube-dl(1) man page for more details and descriptions. - format = best + format = bestvideo+bestaudio Bugs diff --git a/comp b/comp index f658692..1ce90d5 100755 --- a/comp +++ b/comp @@ -16,10 +16,9 @@ # # Copyright (C) 2017 Nguyễn Gia Phong -__version__ = '0.4.5' +__version__ = '0.4.6' import curses -import json import re from argparse import ArgumentParser from collections import deque @@ -27,14 +26,12 @@ from configparser import ConfigParser from curses.ascii import ctrl, alt from functools import reduce from gettext import bindtextdomain, gettext as _, textdomain -from os import makedirs -from os.path import abspath, dirname, expanduser, expandvars +from os.path import expanduser from threading import Thread from traceback import print_exception from mpv import MPV from pkg_resources import resource_filename -from youtube_dl import YoutubeDL from omp import extract_info, Omp @@ -332,7 +329,8 @@ config.read(args.config) mode = config.get('comp', 'play-mode', fallback='play-current') mpv_args = dict(config['mpv']) if 'mpv' in config else {} if args.vo is not None: mpv_args['vo'] = args.vo -ytdlf = args.format or config.get('youtube-dl', 'format', fallback='best') +ytdlf = args.format or config.get('youtube-dl', 'format', + fallback='bestvideo+bestaudio') with Comp(entries, json_file, mode, mpv_args, ytdlf) as comp: while True: diff --git a/omp/omp.py b/omp/omp.py index dbf5869..1a0a35c 100644 --- a/omp/omp.py +++ b/omp/omp.py @@ -24,17 +24,14 @@ from collections import deque from gettext import bindtextdomain, gettext as _, textdomain from itertools import cycle from os import makedirs -from os.path import abspath, dirname, expanduser, expandvars, isfile +from os.path import abspath, dirname, expanduser, expandvars from random import choice from sys import exc_info -from time import gmtime, sleep, strftime -from urllib import request -from youtube_dl import YoutubeDL from pkg_resources import resource_filename -from mpv import MPV, MpvFormat +from mpv import MPV -from .ie import JSON_KEYS, extract_info +from .ie import JSON_KEYS # Init gettext bindtextdomain('omp', resource_filename('omp', 'locale')) diff --git a/settings.ini b/settings.ini index 9fc966a..dcade2c 100644 --- a/settings.ini +++ b/settings.ini @@ -18,4 +18,4 @@ play-mode = play-current [youtube-dl] # Video format/quality to be passed to youtube-dl. See FORMAT SELECTION in # youtube-dl(1) man page for more details and descriptions. -format = best +format = bestvideo+bestaudio diff --git a/setup.py b/setup.py index c41c14f..fbd0aee 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open('README.rst') as f: setup( name='comp', - version='0.4.5', + version='0.4.6', description=('Curses Omni Media Player'), long_description=long_description, url='https://github.com/McSinyx/comp', diff --git a/test/playlist.json b/test/playlist.json index f3c68da..2a41d7d 100644 --- a/test/playlist.json +++ b/test/playlist.json @@ -83,6 +83,13 @@ "selected": false, "title": "David Banner - Play (Dirty version)" }, + { + "duration": "00:04:14", + "error": false, + "filename": "https://www.youtube.com/watch?v=NmCFY1oYDeM", + "selected": false, + "title": "John Legend - Love Me Now (Video)" + }, { "duration": "00:03:55", "error": false, @@ -105,7 +112,7 @@ "title": "Best Goat Song Versions Compilation Ever! (HD)" }, { - "duration": "00:00:00", + "duration": "00:04:03", "error": false, "filename": "https://youtu.be/dMK_npDG12Q", "selected": false, @@ -147,7 +154,7 @@ "title": "Can't Stop the SUSE - (Can't Stop the Feeling parody)" }, { - "duration": "00:00:00", + "duration": "00:04:28", "error": false, "filename": "https://youtu.be/SYRlTISvjww", "selected": false, @@ -161,7 +168,7 @@ "title": "What Does the Chameleon Say? (Ylvis - What Does the Fox Say parody)" }, { - "duration": "00:00:00", + "duration": "00:03:46", "error": false, "filename": "https://youtu.be/M9bq_alk-sw", "selected": false, @@ -175,7 +182,7 @@ "title": "Linus Said - Music Parody (Momma Said)" }, { - "duration": "00:00:00", + "duration": "00:03:58", "error": false, "filename": "https://youtu.be/4VrhlyIgo3M", "selected": false,