Skip to content

Commit

Permalink
v0.5.11
Browse files Browse the repository at this point in the history
  • Loading branch information
rembo10 committed Feb 20, 2016
2 parents 5eeab85 + eeff731 commit 4b3b8d2
Show file tree
Hide file tree
Showing 25 changed files with 1,619 additions and 171 deletions.
16 changes: 11 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
[Tt]est[Rr]esult*
/cache
/logs
.project
.pydevproject

# coverage generated:
/cover-html/
.coverage
.coveralls.yml

# Compiled source #
###################
Expand Down Expand Up @@ -61,8 +71,4 @@ Thumbs.db
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
/cache
/logs
.project
.pydevproject
.vscode
29 changes: 23 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,36 @@
# http://about.travis-ci.org/docs/

language: python
sudo: false

cache:
pip: true
directories:
- lib

# Available Python versions:
# http://about.travis-ci.org/docs/user/ci-environment/#Python-VM-images
python:
- "2.6"
- "2.7"
matrix:
include:
- python: "2.7"
env: SENDCOVERAGE=1

# pylint 1.4 does not run under python 2.6
install:
- pip install pyOpenSSL
- pip install pylint==1.3.1
- pip install pyflakes
- pip install pep8
- pip install pyOpenSSL
- pip install pylint==1.3.1
- pip install pyflakes
- pip install pep8
# coverage stuff:
- pip install coveralls
- pip install coverage
script:
- pep8 headphones
- pyflakes headphones
- nosetests headphones
- nosetests

after_success:
# coverage stuff:
- if [ $SENDCOVERAGE ]; then coveralls; fi
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## v0.5.11
Released 20 February 2016

Highlights:
* Added: Soft chroot option
* Fixed: Post processing temporary directory fix (#2504)
* Fixed: Ubuntu init script (#2509)
* Fixed: Image cache uncaught exception (#2485)
* Improved: $Date/$date variable in folder renaming
* Improved: Reuse transmission session id

The full list of commits can be found [here](https://github.com/rembo10/headphones/compare/v0.5.10...v0.5.11).

## v0.5.10
Released 29 January 2016

Expand Down
5 changes: 4 additions & 1 deletion Headphones.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ def main():
headphones.DB_FILE = os.path.join(headphones.DATA_DIR, 'headphones.db')

# Read config and start logging
headphones.initialize(config_file)
try:
headphones.initialize(config_file)
except headphones.exceptions.SoftChrootError as e:
raise SystemExit('FATAL ERROR')

if headphones.DAEMON:
headphones.daemonize()
Expand Down
2 changes: 1 addition & 1 deletion data/interfaces/default/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ <h1 class="clearfix"><i class="fa fa-gear"></i> Settings</h1>
</div>
<div class="row">
<label>Plex Token</label><input type="text" name="plex_token" value="${config['plex_token']}" size="30">
<small>Plex Token (for use with Plex Home)</small>
<small>Plex Token (for use with Plex Home)</small>
</div>
<div class="checkbox row">
<input type="checkbox" name="plex_update" value="1" ${config['plex_update']} /><label>Update Plex Library</label>
Expand Down
11 changes: 11 additions & 0 deletions data/interfaces/default/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,17 @@ textarea,
button {
font: 99%;
}
select {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
background: #4F4F4F;
border: 0;
border-bottom: 1px solid rgba(0, 0, 0, 0.25);
color: #fff;
padding: 3px 10px;
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25);
}
textarea {
overflow: auto;
}
Expand Down
18 changes: 17 additions & 1 deletion data/interfaces/default/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,23 @@ table {


// Forms
select, input, textarea, button { font: 99%;}
select, input, textarea, button
{
font: 99%;
}

select
{
.rounded(5px);
background: #4F4F4F;
border: 0;
border-bottom: 1px solid rgba(0, 0, 0, 0.25);
color: #fff;
padding: 3px 10px;
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25);
}


textarea {overflow: auto;}
input { .rounded(3px);}
input:invalid, textarea:invalid {
Expand Down
14 changes: 12 additions & 2 deletions headphones/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
from apscheduler.triggers.interval import IntervalTrigger
from headphones import versioncheck, logger
import headphones.config

from headphones.softchroot import SoftChroot
import headphones.exceptions

# (append new extras to the end)
POSSIBLE_EXTRAS = [
Expand Down Expand Up @@ -74,6 +75,7 @@
DATA_DIR = None

CONFIG = None
SOFT_CHROOT = None

DB_FILE = None

Expand All @@ -92,11 +94,11 @@

UMASK = None


def initialize(config_file):
with INIT_LOCK:

global CONFIG
global SOFT_CHROOT
global _INITIALIZED
global CURRENT_VERSION
global LATEST_VERSION
Expand Down Expand Up @@ -136,6 +138,14 @@ def initialize(config_file):
logger.initLogger(console=not QUIET, log_dir=CONFIG.LOG_DIR,
verbose=VERBOSE)

try:
SOFT_CHROOT = SoftChroot(str(CONFIG.SOFT_CHROOT))
if SOFT_CHROOT.isEnabled():
logger.info("Soft-chroot enabled for dir: %s", str(CONFIG.SOFT_CHROOT))
except exceptions.SoftChrootError as e:
logger.error("SoftChroot error: %s", e)
raise e

if not CONFIG.CACHE_DIR:
# Put the cache dir in the data dir for now
CONFIG.CACHE_DIR = os.path.join(DATA_DIR, 'cache')
Expand Down
13 changes: 13 additions & 0 deletions headphones/albumart_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#import unittest
#import mock
from headphones.unittestcompat import TestCase

import headphones.albumart

# no tests...
class AlbumArtTest(TestCase):
def test_nothing(self):
x = 100 - 2 * 50
if x:
headphones.albumart.getAlbumArt('asdf')
self.assertTrue(True)
2 changes: 1 addition & 1 deletion headphones/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _get_thumb_url(self, data):
return None

for image in images:
if image['size'] == 'medium':
if image['size'] == 'medium' and '#text' in image:
thumb_url = image['#text']
break

Expand Down
52 changes: 33 additions & 19 deletions headphones/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ def bool_int(value):
value = 0
return int(bool(value))

class path(str):
"""Internal 'marker' type for paths in config."""

@staticmethod
def __call__(val):
return path(val)

def __new__(cls, *args, **kw):
hstr = str.__new__(cls, *args, **kw)
return hstr

def __repr__(self):
return 'headphones.config.path(%s)' % self

_CONFIG_DEFINITIONS = {
'ADD_ALBUM_ART': (int, 'General', 0),
Expand All @@ -31,11 +44,11 @@ def bool_int(value):
'AUTO_ADD_ARTISTS': (int, 'General', 1),
'BITRATE': (int, 'General', 192),
'BLACKHOLE': (int, 'General', 0),
'BLACKHOLE_DIR': (str, 'General', ''),
'BLACKHOLE_DIR': (path, 'General', ''),
'BOXCAR_ENABLED': (int, 'Boxcar', 0),
'BOXCAR_ONSNATCH': (int, 'Boxcar', 0),
'BOXCAR_TOKEN': (str, 'Boxcar', ''),
'CACHE_DIR': (str, 'General', ''),
'CACHE_DIR': (path, 'General', ''),
'CACHE_SIZEMB': (int, 'Advanced', 32),
'CHECK_GITHUB': (int, 'General', 1),
'CHECK_GITHUB_INTERVAL': (int, 'General', 360),
Expand All @@ -44,21 +57,21 @@ def bool_int(value):
'CONFIG_VERSION': (str, 'General', '0'),
'CORRECT_METADATA': (int, 'General', 0),
'CUE_SPLIT': (int, 'General', 1),
'CUE_SPLIT_FLAC_PATH': (str, 'General', ''),
'CUE_SPLIT_SHNTOOL_PATH': (str, 'General', ''),
'CUE_SPLIT_FLAC_PATH': (path, 'General', ''),
'CUE_SPLIT_SHNTOOL_PATH': (path, 'General', ''),
'CUSTOMAUTH': (int, 'General', 0),
'CUSTOMHOST': (str, 'General', 'localhost'),
'CUSTOMPASS': (str, 'General', ''),
'CUSTOMPORT': (int, 'General', 5000),
'CUSTOMSLEEP': (int, 'General', 1),
'CUSTOMUSER': (str, 'General', ''),
'DELETE_LOSSLESS_FILES': (int, 'General', 1),
'DESTINATION_DIR': (str, 'General', ''),
'DESTINATION_DIR': (path, 'General', ''),
'DETECT_BITRATE': (int, 'General', 0),
'DO_NOT_PROCESS_UNMATCHED': (int, 'General', 0),
'DOWNLOAD_DIR': (str, 'General', ''),
'DOWNLOAD_DIR': (path, 'General', ''),
'DOWNLOAD_SCAN_INTERVAL': (int, 'General', 5),
'DOWNLOAD_TORRENT_DIR': (str, 'General', ''),
'DOWNLOAD_TORRENT_DIR': (path, 'General', ''),
'DO_NOT_OVERRIDE_GIT_BRANCH': (int, 'General', 0),
'EMAIL_ENABLED': (int, 'Email', 0),
'EMAIL_FROM': (str, 'Email', ''),
Expand All @@ -74,14 +87,14 @@ def bool_int(value):
'EMBED_LYRICS': (int, 'General', 0),
'ENABLE_HTTPS': (int, 'General', 0),
'ENCODER': (str, 'General', 'ffmpeg'),
'ENCODERFOLDER': (str, 'General', ''),
'ENCODERFOLDER': (path, 'General', ''),
'ENCODERLOSSLESS': (int, 'General', 1),
'ENCODEROUTPUTFORMAT': (str, 'General', 'mp3'),
'ENCODERQUALITY': (int, 'General', 2),
'ENCODERVBRCBR': (str, 'General', 'cbr'),
'ENCODER_MULTICORE': (int, 'General', 0),
'ENCODER_MULTICORE_COUNT': (int, 'General', 0),
'ENCODER_PATH': (str, 'General', ''),
'ENCODER_PATH': (path, 'General', ''),
'EXTRAS': (str, 'General', ''),
'EXTRA_NEWZNABS': (list, 'Newznab', ''),
'EXTRA_TORZNABS': (list, 'Torznab', ''),
Expand All @@ -94,7 +107,7 @@ def bool_int(value):
'FOLDER_PERMISSIONS': (str, 'General', '0755'),
'FREEZE_DB': (int, 'General', 0),
'GIT_BRANCH': (str, 'General', 'master'),
'GIT_PATH': (str, 'General', ''),
'GIT_PATH': (path, 'General', ''),
'GIT_USER': (str, 'General', 'rembo10'),
'GROWL_ENABLED': (int, 'Growl', 0),
'GROWL_HOST': (str, 'Growl', ''),
Expand All @@ -103,8 +116,8 @@ def bool_int(value):
'HEADPHONES_INDEXER': (bool_int, 'General', False),
'HPPASS': (str, 'General', ''),
'HPUSER': (str, 'General', ''),
'HTTPS_CERT': (str, 'General', ''),
'HTTPS_KEY': (str, 'General', ''),
'HTTPS_CERT': (path, 'General', ''),
'HTTPS_KEY': (path, 'General', ''),
'HTTP_HOST': (str, 'General', 'localhost'),
'HTTP_PASSWORD': (str, 'General', ''),
'HTTP_PORT': (int, 'General', 8181),
Expand All @@ -114,8 +127,8 @@ def bool_int(value):
'IDTAG': (int, 'Beets', 0),
'IGNORE_CLEAN_RELEASES': (int, 'General', 0),
'IGNORED_WORDS': (str, 'General', ''),
'IGNORED_FOLDERS': (list, 'Advanced', []),
'IGNORED_FILES': (list, 'Advanced', []),
'IGNORED_FOLDERS': (list, 'Advanced', []), # path
'IGNORED_FILES': (list, 'Advanced', []), # path
'INCLUDE_EXTRAS': (int, 'General', 0),
'INTERFACE': (str, 'General', 'default'),
'JOURNAL_MODE': (str, 'Advanced', 'wal'),
Expand All @@ -130,17 +143,17 @@ def bool_int(value):
'LIBRARYSCAN_INTERVAL': (int, 'General', 300),
'LMS_ENABLED': (int, 'LMS', 0),
'LMS_HOST': (str, 'LMS', ''),
'LOG_DIR': (str, 'General', ''),
'LOG_DIR': (path, 'General', ''),
'LOSSLESS_BITRATE_FROM': (int, 'General', 0),
'LOSSLESS_BITRATE_TO': (int, 'General', 0),
'LOSSLESS_DESTINATION_DIR': (str, 'General', ''),
'LOSSLESS_DESTINATION_DIR': (path, 'General', ''),
'MB_IGNORE_AGE': (int, 'General', 365),
'MININOVA': (int, 'Mininova', 0),
'MININOVA_RATIO': (str, 'Mininova', ''),
'MIRROR': (str, 'General', 'musicbrainz.org'),
'MOVE_FILES': (int, 'General', 0),
'MPC_ENABLED': (bool_int, 'MPC', False),
'MUSIC_DIR': (str, 'General', ''),
'MUSIC_DIR': (path, 'General', ''),
'MUSIC_ENCODER': (int, 'General', 0),
'NEWZNAB': (int, 'Newznab', 0),
'NEWZNAB_APIKEY': (str, 'Newznab', ''),
Expand Down Expand Up @@ -223,6 +236,7 @@ def bool_int(value):
'SAB_USERNAME': (str, 'SABnzbd', ''),
'SAMPLINGFREQUENCY': (int, 'General', 44100),
'SEARCH_INTERVAL': (int, 'General', 1440),
'SOFT_CHROOT': (path, 'General', ''),
'SONGKICK_APIKEY': (str, 'Songkick', 'nd1We7dFW2RqxPw8'),
'SONGKICK_ENABLED': (int, 'Songkick', 1),
'SONGKICK_FILTER_ENABLED': (int, 'Songkick', 0),
Expand All @@ -234,7 +248,7 @@ def bool_int(value):
'SUBSONIC_PASSWORD': (str, 'Subsonic', ''),
'SUBSONIC_USERNAME': (str, 'Subsonic', ''),
'SYNOINDEX_ENABLED': (int, 'Synoindex', 0),
'TORRENTBLACKHOLE_DIR': (str, 'General', ''),
'TORRENTBLACKHOLE_DIR': (path, 'General', ''),
'TORRENT_DOWNLOADER': (int, 'General', 0),
'TORRENT_REMOVAL_INTERVAL': (int, 'General', 720),
'TORZNAB': (int, 'Torznab', 0),
Expand Down Expand Up @@ -295,7 +309,7 @@ def _define(self, name):
definition = _CONFIG_DEFINITIONS[key]
if len(definition) == 3:
definition_type, section, default = definition
else:
elif len(definition) == 4:
definition_type, section, _, default = definition
return key, definition_type, section, ini_key, default

Expand Down
Loading

0 comments on commit 4b3b8d2

Please sign in to comment.