mirror of
https://github.com/beetbox/beets.git
synced 2026-02-27 17:53:12 +01:00
Merge pull request #3602 from jef/jef/github-actions
feat: added github actions
This commit is contained in:
commit
3aad6f42ce
11 changed files with 128 additions and 118 deletions
95
.github/workflows/ci.yaml
vendored
Normal file
95
.github/workflows/ci.yaml
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
name: ci
|
||||
on: push
|
||||
jobs:
|
||||
test-27:
|
||||
runs-on: ${{ matrix.platform }}
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ ubuntu-latest ]
|
||||
env:
|
||||
NOSE_SHOW_SKIPPED: 1
|
||||
PY_COLOR: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 2.7
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 2.7
|
||||
- uses: actions/cache@v1
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- uses: actions/cache@v1
|
||||
if: startsWith(runner.os, 'Windows')
|
||||
with:
|
||||
path: ~\AppData\Local\pip\Cache
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install base dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install tox sphinx
|
||||
- name: Test with tox
|
||||
run: tox -e py27-test
|
||||
test-3x:
|
||||
runs-on: ${{ matrix.platform }}
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ ubuntu-latest ]
|
||||
python-version: [ 5, 6, 7, 8 ]
|
||||
env:
|
||||
NOSE_SHOW_SKIPPED: 1
|
||||
PY_COLOR: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.${{ matrix.python-version }}
|
||||
- uses: actions/cache@v1
|
||||
if: startsWith(runner.os, 'Linux')
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- uses: actions/cache@v1
|
||||
if: startsWith(runner.os, 'Windows')
|
||||
with:
|
||||
path: ~\AppData\Local\pip\Cache
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
- name: Install base dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install tox sphinx
|
||||
- name: Test, coverage, and flake8 with tox
|
||||
if: matrix.python-version == '8'
|
||||
run: |
|
||||
tox -e py3${{ matrix.python-version }}-test
|
||||
tox -e py3${{ matrix.python-version }}-cov
|
||||
tox -e py3${{ matrix.python-version }}-flake8
|
||||
pip install codecov || true
|
||||
codecov || true
|
||||
- name: Test with tox
|
||||
if: matrix.python-version != '8'
|
||||
run: tox -e py3${{ matrix.python-version }}-test
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python to build docs with Sphinx
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 2.7
|
||||
- name: Install base dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install tox sphinx
|
||||
- name: Build and check docs using tox
|
||||
run: tox -e docs
|
||||
87
.travis.yml
87
.travis.yml
|
|
@ -1,87 +0,0 @@
|
|||
dist: trusty
|
||||
sudo: required
|
||||
language: python
|
||||
|
||||
env:
|
||||
global:
|
||||
# Undocumented feature of nose-show-skipped.
|
||||
NOSE_SHOW_SKIPPED: 1
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- python: 2.7.13
|
||||
env: {TOX_ENV: py27-cov, COVERAGE: 1}
|
||||
- python: 2.7.13
|
||||
env: {TOX_ENV: py27-test}
|
||||
# - python: 3.4
|
||||
# env: {TOX_ENV: py34-test}
|
||||
# - python: 3.4_with_system_site_packages
|
||||
# env: {TOX_ENV: py34-test}
|
||||
- python: 3.5
|
||||
env: {TOX_ENV: py35-test}
|
||||
- python: 3.6
|
||||
env: {TOX_ENV: py36-test}
|
||||
- python: 3.7
|
||||
env: {TOX_ENV: py37-test}
|
||||
dist: xenial
|
||||
- python: 3.8
|
||||
env: {TOX_ENV: py38-test}
|
||||
dist: xenial
|
||||
# - python: pypy
|
||||
# - env: {TOX_ENV: pypy-test}
|
||||
- python: 3.6
|
||||
env: {TOX_ENV: py36-flake8}
|
||||
- python: 2.7.13
|
||||
env: {TOX_ENV: docs}
|
||||
# Non-Python dependencies.
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: "deb https://archive.ubuntu.com/ubuntu/ trusty multiverse"
|
||||
- sourceline: "deb https://archive.ubuntu.com/ubuntu/ trusty-updates multiverse"
|
||||
packages:
|
||||
- bash-completion
|
||||
- gir1.2-gst-plugins-base-1.0
|
||||
- gir1.2-gstreamer-1.0
|
||||
- gstreamer1.0-plugins-good
|
||||
- gstreamer1.0-plugins-bad
|
||||
- imagemagick
|
||||
- python-gi
|
||||
- python-gst-1.0
|
||||
- python3-gi
|
||||
- python3-gst-1.0
|
||||
- unrar
|
||||
|
||||
# To install dependencies, tell tox to do everything but actually running the
|
||||
# test.
|
||||
install:
|
||||
- travis_retry pip install tox sphinx
|
||||
# upgrade requests to satisfy sphinx linkcheck (for building man pages)
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == *_site_packages ]]; then pip install -U requests; fi
|
||||
- travis_retry tox -e $TOX_ENV --notest
|
||||
|
||||
script:
|
||||
# prevents "libdc1394 error: Failed to initialize libdc1394" errors
|
||||
- sudo ln -s /dev/null /dev/raw1394
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == *_site_packages ]]; then SITE_PACKAGES=--sitepackages; fi
|
||||
# pip in trusty breaks on packages prefixed with "_". See https://github.com/pypa/pip/issues/3681
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == 3.4_with_system_site_packages ]]; then sudo rm -rf /usr/lib/python3/dist-packages/_lxc-0.1.egg-info; fi
|
||||
- tox -e $TOX_ENV $SITE_PACKAGES
|
||||
|
||||
# Report coverage to codecov.io.
|
||||
before_install:
|
||||
- "[ ! -z $COVERAGE ] && travis_retry pip install codecov || true"
|
||||
after_success:
|
||||
- "[ ! -z $COVERAGE ] && codecov || true"
|
||||
|
||||
cache:
|
||||
pip: true
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
channels:
|
||||
- "irc.freenode.org#beets"
|
||||
use_notice: true
|
||||
skip_join: true
|
||||
on_success: change
|
||||
on_failure: always
|
||||
|
|
@ -332,7 +332,7 @@ class Distance(object):
|
|||
self._penalties = {}
|
||||
|
||||
@LazyClassProperty
|
||||
def _weights(cls): # noqa
|
||||
def _weights(cls): # noqa: N805
|
||||
"""A dictionary from keys to floating-point weights.
|
||||
"""
|
||||
weights_view = config['match']['distance_weights']
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import sys
|
|||
import codecs
|
||||
import json
|
||||
import csv
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree import ElementTree
|
||||
|
||||
from datetime import datetime, date
|
||||
from beets.plugins import BeetsPlugin
|
||||
|
|
@ -188,18 +188,18 @@ class XMLFormat(ExportFormat):
|
|||
|
||||
def export(self, data, **kwargs):
|
||||
# Creates the XML file structure.
|
||||
library = ET.Element(u'library')
|
||||
tracks = ET.SubElement(library, u'tracks')
|
||||
library = ElementTree.Element(u'library')
|
||||
tracks = ElementTree.SubElement(library, u'tracks')
|
||||
if data and isinstance(data[0], dict):
|
||||
for index, item in enumerate(data):
|
||||
track = ET.SubElement(tracks, u'track')
|
||||
track = ElementTree.SubElement(tracks, u'track')
|
||||
for key, value in item.items():
|
||||
track_details = ET.SubElement(track, key)
|
||||
track_details = ElementTree.SubElement(track, key)
|
||||
track_details.text = value
|
||||
# Depending on the version of python the encoding needs to change
|
||||
try:
|
||||
data = ET.tostring(library, encoding='unicode', **kwargs)
|
||||
data = ElementTree.tostring(library, encoding='unicode', **kwargs)
|
||||
except LookupError:
|
||||
data = ET.tostring(library, encoding='utf-8', **kwargs)
|
||||
data = ElementTree.tostring(library, encoding='utf-8', **kwargs)
|
||||
|
||||
self.out_stream.write(data)
|
||||
|
|
|
|||
|
|
@ -912,7 +912,7 @@ class LyricsPlugin(plugins.BeetsPlugin):
|
|||
return _scrape_strip_cruft(lyrics, True)
|
||||
|
||||
def append_translation(self, text, to_lang):
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree import ElementTree
|
||||
|
||||
if not self.bing_auth_token:
|
||||
self.bing_auth_token = self.get_bing_access_token()
|
||||
|
|
@ -930,7 +930,8 @@ class LyricsPlugin(plugins.BeetsPlugin):
|
|||
self.bing_auth_token = None
|
||||
return self.append_translation(text, to_lang)
|
||||
return text
|
||||
lines_translated = ET.fromstring(r.text.encode('utf-8')).text
|
||||
lines_translated = ElementTree.fromstring(
|
||||
r.text.encode('utf-8')).text
|
||||
# Use a translation mapping dict to build resulting lyrics
|
||||
translations = dict(zip(text_lines, lines_translated.split('|')))
|
||||
result = ''
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class Amarok(MetaSource):
|
|||
'amarok_lastplayed': DateType(),
|
||||
}
|
||||
|
||||
queryXML = u'<query version="1.0"> \
|
||||
query_xml = u'<query version="1.0"> \
|
||||
<filters> \
|
||||
<and><include field="filename" value=%s /></and> \
|
||||
</filters> \
|
||||
|
|
@ -72,7 +72,7 @@ class Amarok(MetaSource):
|
|||
# of the result set. So query for the filename and then try to match
|
||||
# the correct item from the results we get back
|
||||
results = self.collection.Query(
|
||||
self.queryXML % quoteattr(basename(path))
|
||||
self.query_xml % quoteattr(basename(path))
|
||||
)
|
||||
for result in results:
|
||||
if result['xesam:url'] != path:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Put something like the following in your config.yaml to configure:
|
|||
from __future__ import division, absolute_import, print_function
|
||||
|
||||
import requests
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree import ElementTree
|
||||
from six.moves.urllib.parse import urljoin, urlencode
|
||||
from beets import config
|
||||
from beets.plugins import BeetsPlugin
|
||||
|
|
@ -28,7 +28,7 @@ def get_music_section(host, port, token, library_name):
|
|||
r = requests.get(url)
|
||||
|
||||
# Parse xml tree and extract music section key.
|
||||
tree = ET.fromstring(r.content)
|
||||
tree = ElementTree.fromstring(r.content)
|
||||
for child in tree.findall('Directory'):
|
||||
if child.get('title') == library_name:
|
||||
return child.get('key')
|
||||
|
|
|
|||
|
|
@ -105,17 +105,18 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
|||
|
||||
playlist_data = (playlist['name'],)
|
||||
try:
|
||||
for key, Model in (('query', Item), ('album_query', Album)):
|
||||
for key, model_cls in (('query', Item),
|
||||
('album_query', Album)):
|
||||
qs = playlist.get(key)
|
||||
if qs is None:
|
||||
query_and_sort = None, None
|
||||
elif isinstance(qs, six.string_types):
|
||||
query_and_sort = parse_query_string(qs, Model)
|
||||
query_and_sort = parse_query_string(qs, model_cls)
|
||||
elif len(qs) == 1:
|
||||
query_and_sort = parse_query_string(qs[0], Model)
|
||||
query_and_sort = parse_query_string(qs[0], model_cls)
|
||||
else:
|
||||
# multiple queries and sorts
|
||||
queries, sorts = zip(*(parse_query_string(q, Model)
|
||||
queries, sorts = zip(*(parse_query_string(q, model_cls)
|
||||
for q in qs))
|
||||
query = OrQuery(queries)
|
||||
final_sorts = []
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ from __future__ import absolute_import, division, print_function
|
|||
|
||||
import random
|
||||
import string
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree import ElementTree
|
||||
from hashlib import md5
|
||||
from urllib.parse import urlencode
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ class SubsonicPlaylistPlugin(BeetsPlugin):
|
|||
|
||||
def get_playlist(self, playlist_id):
|
||||
xml = self.send('getPlaylist', {'id': playlist_id}).text
|
||||
playlist = ET.fromstring(xml)[0]
|
||||
playlist = ElementTree.fromstring(xml)[0]
|
||||
if playlist.attrib.get('code', '200') != '200':
|
||||
alt_error = 'error getting playlist, but no error message found'
|
||||
self._log.warn(playlist.attrib.get('message', alt_error))
|
||||
|
|
@ -101,8 +101,8 @@ class SubsonicPlaylistPlugin(BeetsPlugin):
|
|||
self.config.set_args(opts)
|
||||
ids = self.config['playlist_ids'].as_str_seq()
|
||||
if self.config['playlist_names'].as_str_seq():
|
||||
playlists = ET.fromstring(self.send('getPlaylists').text)[
|
||||
0]
|
||||
playlists = ElementTree.fromstring(
|
||||
self.send('getPlaylists').text)[0]
|
||||
if playlists.attrib.get('code', '200') != '200':
|
||||
alt_error = 'error getting playlists,' \
|
||||
' but no error message found'
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ from test.helper import TestHelper
|
|||
import re # used to test csv format
|
||||
import json
|
||||
from xml.etree.ElementTree import Element
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree import ElementTree
|
||||
|
||||
|
||||
class ExportPluginTest(unittest.TestCase, TestHelper):
|
||||
|
|
@ -85,7 +85,7 @@ class ExportPluginTest(unittest.TestCase, TestHelper):
|
|||
format_type='xml',
|
||||
artist=item1.artist
|
||||
)
|
||||
library = ET.fromstring(out)
|
||||
library = ElementTree.fromstring(out)
|
||||
self.assertIsInstance(library, Element)
|
||||
for track in library[0]:
|
||||
for details in track:
|
||||
|
|
|
|||
14
tox.ini
14
tox.ini
|
|
@ -31,7 +31,7 @@ deps =
|
|||
flake8-coding
|
||||
flake8-future-import
|
||||
flake8-blind-except
|
||||
pep8-naming~=0.7.0
|
||||
pep8-naming
|
||||
files = beets beetsplug beet test setup.py docs
|
||||
|
||||
[testenv]
|
||||
|
|
@ -46,12 +46,12 @@ commands =
|
|||
py27-test: python -m nose {posargs}
|
||||
py3{4,5,6,7,8}-cov: python -bb -m nose --with-coverage {posargs}
|
||||
py3{4,5,6,7,8}-test: python -bb -m nose {posargs}
|
||||
py27-flake8: flake8 --min-version 2.7 {posargs} {[_flake8]files}
|
||||
py34-flake8: flake8 --min-version 3.4 {posargs} {[_flake8]files}
|
||||
py35-flake8: flake8 --min-version 3.5 {posargs} {[_flake8]files}
|
||||
py36-flake8: flake8 --min-version 3.6 {posargs} {[_flake8]files}
|
||||
py37-flake8: flake8 --min-version 3.7 {posargs} {[_flake8]files}
|
||||
py38-flake8: flake8 --min-version 3.8 {posargs} {[_flake8]files}
|
||||
py27-flake8: flake8 {posargs} {[_flake8]files}
|
||||
py34-flake8: flake8 {posargs} {[_flake8]files}
|
||||
py35-flake8: flake8 {posargs} {[_flake8]files}
|
||||
py36-flake8: flake8 {posargs} {[_flake8]files}
|
||||
py37-flake8: flake8 {posargs} {[_flake8]files}
|
||||
py38-flake8: flake8 {posargs} {[_flake8]files}
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python2.7
|
||||
|
|
|
|||
Loading…
Reference in a new issue