import psutil import pyinotify import traceback from PIL import Image from libs import config from libs import log from libs import cache from libs import db from rainwave import playlist from rainwave.playlist_objects.song import PassableScanError from libs.filetools import which mp3gain_path = which("mp3gain") # Art can be scanned before the music itself is scanned, in which case the art will # have no home. We need to account for that by using an album art queue. # It's a hack, but a necessary one. # We need a flag for immediate art because we don't want to worry about # threads or mutexes on the array when monitoring. immediate_art = True _album_art_queue = [] mimetypes.init() def _common_init(): if config.get("mp3gain_scan") and not mp3gain_path: raise Exception( "mp3gain_scan flag in config is enabled, but could not find mp3gain executable." )
from libs import db from libs import config from libs import cache from libs import filetools from libs import log from rainwave import rating from api import fieldtypes from rainwave.playlist_objects.artist import Artist from rainwave.playlist_objects.album import Album from rainwave.playlist_objects.songgroup import SongGroup from rainwave.playlist_objects.metadata import make_searchable_string from rainwave.playlist_objects import cooldown from rainwave.playlist_objects.metadata import MetadataUpdateError _mp3gain_path = filetools.which("mp3gain") num_songs = {} num_origin_songs = {} def set_umask(): os.setpgrp() os.umask(002) def zip_metadata(tag_metadata, kept_metadata): new_metadata = copy.copy(tag_metadata) for kept in kept_metadata: found = False for tag in tag_metadata:
import psutil import watchdog.events import watchdog.observers from PIL import Image from libs import config from libs import log from libs import cache from libs import db from rainwave import playlist from rainwave.playlist_objects.song import PassableScanError from libs import filetools mp3gain_path = filetools.which("mp3gain") # Scan errors is pulled from/pushed to cache and is not saved to db. _scan_errors = None # Art can be scanned before the music itself is scanned, in which case the art will # have no home. We need to account for that by using an album art queue. # It's a hack, but a necessary one. _album_art_queue = [] # A flag that's easier than passing around an argument a million times _art_only = False _raise_scan_errors = False mimetypes.init() invalid_filename_characters = (":", ) invalid_characters = ("?", ) # http://stackoverflow.com/questions/3812849/how-to-check-whether-a-directory-is-a-sub-directory-of-another-directory def in_directory(file, directory):
import psutil import watchdog.events import watchdog.observers from PIL import Image from libs import config from libs import log from libs import cache from libs import db from rainwave import playlist from rainwave.playlist_objects.song import PassableScanError from libs.filetools import check_file_is_in_directory, which mp3gain_path = which("mp3gain") # Scan errors is pulled from/pushed to cache and is not saved to db. _scan_errors = None # Art can be scanned before the music itself is scanned, in which case the art will # have no home. We need to account for that by using an album art queue. # It's a hack, but a necessary one. _album_art_queue = [] mimetypes.init() def _common_init(): if config.get("mp3gain_scan") and not mp3gain_path: raise Exception("mp3gain_scan flag in config is enabled, but could not find mp3gain executable.") global _scan_errors _scan_errors = cache.get("backend_scan_errors") if not _scan_errors: