mirror of
https://github.com/beetbox/beets.git
synced 2026-02-01 04:55:38 +01:00
feat: added github actions
only working with linux for now. exact replica of travis basically. should probably try to implement the rest of tox or deprecate some functionality.
This commit is contained in:
parent
6639c1babc
commit
0c3201930c
11 changed files with 150 additions and 63 deletions
77
.github/workflows/ci.yaml
vendored
Normal file
77
.github/workflows/ci.yaml
vendored
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
name: ci
|
||||
on: push
|
||||
jobs:
|
||||
test-27:
|
||||
runs-on: ${{ matrix.platform }}
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ ubuntu-latest ]
|
||||
env:
|
||||
NOSE_SHOW_SKIPPED: 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
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
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
|
||||
tox -e docs
|
||||
test-3x:
|
||||
runs-on: ${{ matrix.platform }}
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [ ubuntu-latest ]
|
||||
python-version: [ 5, 6, 7, 8 ]
|
||||
env:
|
||||
NOSE_SHOW_SKIPPED: 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
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
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: |
|
||||
if [[ ${{ matrix.python-version }} == '8' ]]; then
|
||||
tox -e py3${{ matrix.python-version }}-test
|
||||
tox -e py3${{ matrix.python-version }}-cov
|
||||
tox -e py3${{ matrix.python-version }}-flake8
|
||||
else
|
||||
tox -e py3${{ matrix.python-version }}-test
|
||||
fi
|
||||
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
|
||||
|
|
@ -21,7 +21,7 @@ import sys
|
|||
import codecs
|
||||
import json
|
||||
import csv
|
||||
import xml.etree.ElementTree as ET
|
||||
import xml.etree.ElementTree as et
|
||||
|
||||
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 = et.Element(u'library')
|
||||
tracks = et.SubElement(library, u'tracks')
|
||||
if data and isinstance(data[0], dict):
|
||||
for index, item in enumerate(data):
|
||||
track = ET.SubElement(tracks, u'track')
|
||||
track = et.SubElement(tracks, u'track')
|
||||
for key, value in item.items():
|
||||
track_details = ET.SubElement(track, key)
|
||||
track_details = et.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 = et.tostring(library, encoding='unicode', **kwargs)
|
||||
except LookupError:
|
||||
data = ET.tostring(library, encoding='utf-8', **kwargs)
|
||||
data = et.tostring(library, encoding='utf-8', **kwargs)
|
||||
|
||||
self.out_stream.write(data)
|
||||
|
|
|
|||
|
|
@ -907,7 +907,7 @@ class LyricsPlugin(plugins.BeetsPlugin):
|
|||
return _scrape_strip_cruft(lyrics, True)
|
||||
|
||||
def append_translation(self, text, to_lang):
|
||||
import xml.etree.ElementTree as ET
|
||||
import xml.etree.ElementTree as et
|
||||
|
||||
if not self.bing_auth_token:
|
||||
self.bing_auth_token = self.get_bing_access_token()
|
||||
|
|
@ -925,7 +925,7 @@ 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 = et.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
|
||||
import xml.etree.ElementTree as et
|
||||
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 = et.fromstring(r.content)
|
||||
for child in tree.findall('Directory'):
|
||||
if child.get('title') == library_name:
|
||||
return child.get('key')
|
||||
|
|
|
|||
|
|
@ -105,17 +105,17 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
|||
|
||||
playlist_data = (playlist['name'],)
|
||||
try:
|
||||
for key, Model in (('query', Item), ('album_query', Album)):
|
||||
for key, model 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)
|
||||
elif len(qs) == 1:
|
||||
query_and_sort = parse_query_string(qs[0], Model)
|
||||
query_and_sort = parse_query_string(qs[0], model)
|
||||
else:
|
||||
# multiple queries and sorts
|
||||
queries, sorts = zip(*(parse_query_string(q, Model)
|
||||
queries, sorts = zip(*(parse_query_string(q, model)
|
||||
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
|
||||
import xml.etree.ElementTree as et
|
||||
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 = et.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,9 @@ 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 = et.fromstring(
|
||||
self.send('getPlaylists').text
|
||||
)[0]
|
||||
if playlists.attrib.get('code', '200') != '200':
|
||||
alt_error = 'error getting playlists,' \
|
||||
' but no error message found'
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ from hashlib import md5
|
|||
import os
|
||||
import shutil
|
||||
from itertools import chain
|
||||
from pathlib import PurePosixPath
|
||||
from pathlib2 import PurePosixPath
|
||||
import ctypes
|
||||
import ctypes.util
|
||||
|
||||
|
|
|
|||
4
setup.py
4
setup.py
|
|
@ -122,7 +122,7 @@ setup(
|
|||
'requests_oauthlib'
|
||||
] + (
|
||||
# Tests for the thumbnails plugin need pathlib on Python 2 too.
|
||||
['pathlib'] if (sys.version_info < (3, 4, 0)) else []
|
||||
['pathlib2'] if (sys.version_info < (3, 4, 0)) else []
|
||||
),
|
||||
|
||||
# Plugin (optional) dependencies:
|
||||
|
|
@ -144,7 +144,7 @@ setup(
|
|||
'web': ['flask', 'flask-cors'],
|
||||
'import': ['rarfile'],
|
||||
'thumbnails': ['pyxdg', 'Pillow'] +
|
||||
(['pathlib'] if (sys.version_info < (3, 4, 0)) else []),
|
||||
(['pathlib2'] if (sys.version_info < (3, 4, 0)) else []),
|
||||
'metasync': ['dbus-python'],
|
||||
'sonosupdate': ['soco'],
|
||||
'scrub': ['mutagen>=1.33'],
|
||||
|
|
|
|||
|
|
@ -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
|
||||
import xml.etree.ElementTree as et
|
||||
|
||||
|
||||
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 = et.fromstring(out)
|
||||
self.assertIsInstance(library, Element)
|
||||
for track in library[0]:
|
||||
for details in track:
|
||||
|
|
|
|||
83
tox.ini
83
tox.ini
|
|
@ -4,54 +4,63 @@
|
|||
# and then run "tox" from this directory.
|
||||
|
||||
[tox]
|
||||
envlist = py27-test, py37-test, py27-flake8, docs
|
||||
envlist =
|
||||
py27-{test}
|
||||
py38-{test,cov,flake8}
|
||||
docs
|
||||
|
||||
# The exhaustive list of environments is:
|
||||
# envlist = py{27,34,35}-{test,cov}, py{27,34,35}-flake8, docs
|
||||
# exhaustive list
|
||||
# py{27,35,36,37,38}-{test,cov,flake8}, docs
|
||||
|
||||
[_test]
|
||||
deps =
|
||||
beautifulsoup4
|
||||
flask
|
||||
mock
|
||||
nose
|
||||
nose-show-skipped
|
||||
pylast
|
||||
rarfile
|
||||
responses>=0.3.0
|
||||
pyxdg
|
||||
python-mpd2
|
||||
coverage
|
||||
discogs-client
|
||||
requests_oauthlib
|
||||
|
||||
[_flake8]
|
||||
deps =
|
||||
flake8
|
||||
flake8-coding
|
||||
flake8-future-import
|
||||
flake8-blind-except
|
||||
pep8-naming~=0.7.0
|
||||
files = beets beetsplug beet test setup.py docs
|
||||
[gh-actions:env]
|
||||
PLATFORM =
|
||||
ubuntu-latest: linux
|
||||
windows-latest: windows
|
||||
|
||||
[testenv]
|
||||
passenv =
|
||||
NOSE_SHOW_SKIPPED # Undocumented feature of nose-show-skipped.
|
||||
deps =
|
||||
{test,cov}: {[_test]deps}
|
||||
py27: pathlib
|
||||
py{27,34,35,36,37,38}-flake8: {[_flake8]deps}
|
||||
flake8: {[_flake8]deps}
|
||||
py27: pathlib2
|
||||
commands =
|
||||
py27-cov: python -m nose --with-coverage {posargs}
|
||||
py27-test: python -m nose {posargs}
|
||||
py3{4,5,6,7,8}-cov: python -bb -m nose --with-coverage {posargs}
|
||||
py38-cov: python -bb -m nose --with-coverage {posargs}
|
||||
py38-flake8: flake8 {posargs} {[_flake8]files}
|
||||
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}
|
||||
|
||||
[_test]
|
||||
deps =
|
||||
beautifulsoup4
|
||||
coverage
|
||||
flask
|
||||
discogs-client
|
||||
mock
|
||||
nose
|
||||
nose-show-skipped
|
||||
pylast
|
||||
python-mpd2
|
||||
pyxdg
|
||||
rarfile
|
||||
requests_oauthlib
|
||||
responses
|
||||
sphinx
|
||||
|
||||
[_flake8]
|
||||
deps =
|
||||
flake8
|
||||
flake8-blind-except
|
||||
flake8-coding
|
||||
flake8-future-import
|
||||
pep8-naming
|
||||
files =
|
||||
beet
|
||||
beets
|
||||
beetsplug
|
||||
docs
|
||||
setup.py
|
||||
test
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python2.7
|
||||
|
|
|
|||
Loading…
Reference in a new issue