def media_details(self, pathname): from guessit import guessit from common.settings import Settings settings = Settings() if not media(pathname): raise NotMediaFile try: _dir, _fn = split(pathname) if basename(_dir)[:6] == 'Season': _fn = relpath(pathname, settings.SeriesDir) _series = guessit(pathname, '-t episode') self.media_info = MediaInfo(self, filename=pathname, **_series) except Exception, e: _series = guessit(dirname(pathname), '-t episode') self.media_info = MediaInfo(self, filename=pathname, **_series)
def media_details(self, fq_name): from guessit import guessit from titlecase import titlecase if not media(fq_name): raise NotMediaFile _path, _file_name = split(fq_name) _movie_details = guessit(_file_name, '-t movie') if 'alternative_title' in _movie_details: _save_title = _movie_details['title'] _movie_details['title'] = _movie_details['alternative_title'] _movie_details['alternative_title'] = _save_title if 'title' in _movie_details: _movie_details['title'] = titlecase(_movie_details['title']) else: raise TitleFromFileError('Guessit unable to determine title') self.filename = fq_name self.load_attr(_movie_details) return
def media_details(self, fq_name): from guessit import guessit from titlecase import titlecase if not media(fq_name): raise NotMediaFile _path, _file_name = split(fq_name) _movie_details = guessit(_file_name, "-t movie") if "alternative_title" in _movie_details: _save_title = _movie_details["title"] _movie_details["title"] = _movie_details["alternative_title"] _movie_details["alternative_title"] = _save_title if "title" in _movie_details: _movie_details["title"] = titlecase(_movie_details["title"]) else: raise TitleFromFileError("Guessit unable to determine title") self.filename = fq_name self.load_attr(_movie_details) return