def extractMovies(files, onProgress, isInterrupted): # This method will fetch FILE TITLE YEAR IMDB RUNTIME from movies in the video library result = getMovies(movie_properties) movies = list() nbrMovies = len(result) for i in range(nbrMovies): m = result[i] if onProgress: onProgress(i * 100 / nbrMovies) path = removeFromStackAndRecurse(m["file"]) files.add(path) if all([f in m for f in movie_properties]): movie = { "file": path, "title": m["title"], "year": m["year"], "imdb": m["imdbnumber"], "runtime": m["runtime"] } movies.append(movie) if isInterrupted(): break return movies
def extractVideoFilesFromDirectory(files, videoFiles, directory, isInterrupted, onProgress=None): result = getDirectory(directory) thisDirectory = result nbrFiles = len(thisDirectory) for i in range(nbrFiles): f = thisDirectory[i] if onProgress: onProgress(i * 100 / nbrFiles) if f["filetype"] == "directory": extractVideoFilesFromDirectory(files, videoFiles, f["file"], isInterrupted) elif f["filetype"] == "file": path = removeFromStackAndRecurse(f["file"]) if path not in files and getExtension(path) in m_videoExtensions: # Here we could extract subtitles etc. videoFile = { "file": path } videoFiles.append(videoFile) if isInterrupted(): break
def extractMusicVideos(files, onProgress, isInterrupted): # This method will fetch FILE FILE ARTIST TITLE RUNTIME from music videos in the video library result = getMusicVideos(music_videos_properties) musicVideos = list() nbrMusicVideos = len(result) for i in range(nbrMusicVideos): m = result[i] if onProgress: onProgress(i * 100 / nbrMusicVideos) path = removeFromStackAndRecurse(m["file"]) files.add(path) if all([f in m for f in music_videos_properties]): musicVideo = { "file": path, "title": m["title"], "artist": m["artist"], "album": m["album"], "runtime": m["runtime"] } musicVideos.append(musicVideo) if isInterrupted(): break return musicVideos
def extractEpisodes(files, onProgress, isInterrupted): # This method will fetch FILE TVSHOW_TITLE EPISODE_TITLE SEASON EPISODE from episodes in the video library tvshows = dict() result = getTVShows(show_properties) for show in result: if "title" in show: tvshows[show["tvshowid"]] = show["title"] result = getEpisodes(episode_properties) episodes = list() nbrEpisodes = len(result) for i in range(nbrEpisodes): e = result[i] if onProgress: onProgress(i * 100 / nbrEpisodes) path = removeFromStackAndRecurse(e["file"]) files.add(path) if all([f in e for f in episode_properties]) and e["tvshowid"] in tvshows: episode = { "file": path, "tvshow_title": tvshows[e["tvshowid"]], "episode_title": e["title"], "season": e["season"], "episode": e["episode"] } episodes.append(episode) if isInterrupted(): break return episodes