CC-2927: Media Monitor: if new dir is generated in the process of
importing a file, airtime doesn't import the file. - fixed
This commit is contained in:
parent
109bd5d044
commit
973e934151
3 changed files with 7 additions and 13 deletions
|
@ -6,16 +6,18 @@ import logging
|
|||
from subprocess import Popen, PIPE
|
||||
from airtimemetadata import AirtimeMetadata
|
||||
from api_clients import api_client
|
||||
import pyinotify
|
||||
|
||||
class MediaMonitorCommon:
|
||||
|
||||
timestamp_file = "/var/tmp/airtime/last_index"
|
||||
|
||||
def __init__(self, airtime_config):
|
||||
def __init__(self, airtime_config, wm=None):
|
||||
self.supported_file_formats = ['mp3', 'ogg']
|
||||
self.logger = logging.getLogger()
|
||||
self.config = airtime_config
|
||||
self.md_manager = AirtimeMetadata()
|
||||
self.wm = wm
|
||||
|
||||
def is_parent_directory(self, filepath, directory):
|
||||
filepath = os.path.normpath(filepath)
|
||||
|
@ -85,6 +87,7 @@ class MediaMonitorCommon:
|
|||
omask = os.umask(0)
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory, 02777)
|
||||
self.wm.add_watch(directory, pyinotify.ALL_EVENTS, rec=True, auto_add=True)
|
||||
elif not os.path.isdir(directory):
|
||||
#path exists but it is a file not a directory!
|
||||
self.logger.error("path %s exists, but it is not a directory!!!")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue