def short_group_names(groups):
    """
    Find AniDB short group names for release groups

    :param groups: list of groups to find short group names for
    :return: list of shortened group names
    """
    groups = groups.split(",")
    shortGroupList = []
    if helpers.set_up_anidb_connection():
        for groupName in groups:
            try:
                group = sickbeard.ADBA_CONNECTION.group(gname=groupName)
            except AniDBCommandTimeoutError:
                logger.log(
                    u"Timeout while loading group from AniDB. Trying next group",
                    logger.DEBUG)
            except Exception:
                logger.log(
                    u"Failed while loading group from AniDB. Trying next group",
                    logger.DEBUG)
            else:
                for line in group.datalines:
                    if line["shortname"]:
                        shortGroupList.append(line["shortname"])
                    else:
                        if groupName not in shortGroupList:
                            shortGroupList.append(groupName)
    else:
        shortGroupList = groups
    return shortGroupList
Example #2
0
def short_group_names(groups):
    """
    Find AniDB short group names for release groups

    :param groups: list of groups to find short group names for
    :return: list of shortened group names
    """
    groups = groups.split(',')
    short_group_list = []
    if helpers.set_up_anidb_connection():
        for groupName in groups:
            try:
                group = sickbeard.ADBA_CONNECTION.group(gname=groupName)
            except AniDBCommandTimeoutError:
                logger.log('Timeout while loading group from AniDB. Trying next group', logger.DEBUG)
            except Exception:
                logger.log('Failed while loading group from AniDB. Trying next group', logger.DEBUG)
            else:
                for line in group.datalines:
                    if line[b'shortname']:
                        short_group_list.append(line[b'shortname'])
                    else:
                        if groupName not in short_group_list:
                            short_group_list.append(groupName)
    else:
        short_group_list = groups
    return short_group_list
    def _add_to_anidb_mylist(self, filePath):
        if helpers.set_up_anidb_connection():
            if not self.anidbEpisode:  # seams like we could parse the name before, now lets build the anidb object
                self.anidbEpisode = self._build_anidb_episode(sickbeard.ADBA_CONNECTION, filePath)

            self._log(u"Adding the file to the anidb mylist", logger.DEBUG)
            try:
                self.anidbEpisode.add_to_mylist(status=1)  # status = 1 sets the status of the file to "internal HDD"
            except Exception, e:
                self._log(u"exception msg: " + str(e))
Example #4
0
 def _add_to_anidb_mylist(self,filePath):
     if helpers.set_up_anidb_connection():
         if not self.anidbEpisode: # seams like we could parse the name before, now lets build the anidb object
             self.anidbEpisode = self._build_anidb_episode(sickbeard.ADBA_CONNECTION,filePath)
         
         self._log(u"Adding the file to the anidb mylist", logger.DEBUG)
         try:
             self.anidbEpisode.add_to_mylist(status=1) # status = 1 sets the status of the file to "internal HDD"
         except Exception,e :
             self._log(u"exception msg: "+str(e))
    def _analyze_anidb(self, filePath):
        # TODO: rewrite this
        return (None, None, None, None)

        if not helpers.set_up_anidb_connection():
            return (None, None, None, None)

        ep = self._build_anidb_episode(sickbeard.ADBA_CONNECTION, filePath)
        try:
            self._log(u"Trying to lookup " + str(filePath) + " on anidb", logger.MESSAGE)
            ep.load_data()
        except Exception, e:
            self._log(u"exception msg: " + str(e))
            raise InvalidNameException
Example #6
0
    def _analyze_anidb(self, filePath):
        # TODO: rewrite this
        return (None, None, None, None)

        if not helpers.set_up_anidb_connection():
            return (None, None, None, None)

        ep = self._build_anidb_episode(sickbeard.ADBA_CONNECTION, filePath)
        try:
            self._log(u"Trying to lookup " + str(filePath) + " on anidb", logger.MESSAGE)
            ep.load_data()
        except Exception, e:
            self._log(u"exception msg: " + str(e))
            raise InvalidNameException
Example #7
0
def short_group_names(groups):
    groups = groups.split(",")
    shortGroupList = []
    if helpers.set_up_anidb_connection():
        for groupName in groups:
            group = sickbeard.ADBA_CONNECTION.group(gname=groupName)
            for line in group.datalines:
                if line["shortname"]:
                    shortGroupList.append(line["shortname"])
                else:
                    if not groupName in shortGroupList:
                        shortGroupList.append(groupName)
    else:
        shortGroupList = groups
    return shortGroupList
Example #8
0
def short_group_names(groups):
    group_list = groups.split(',')
    short_group_list = []
    if helpers.set_up_anidb_connection():
        for group_name in group_list:
            adba_result = sickbeard.ADBA_CONNECTION.group(gname=group_name)  # no such group is returned for utf8 groups like interrobang
            for line in adba_result.datalines:
                if line['shortname']:
                    short_group_list.append(line['shortname'])
                else:
                    if group_name not in short_group_list:
                        short_group_list.append(group_name)
    else:
        short_group_list = group_list
    return short_group_list
Example #9
0
def short_group_names(groups):
    group_list = groups.split(',')
    short_group_list = []
    if helpers.set_up_anidb_connection():
        for group_name in group_list:
            adba_result = sickbeard.ADBA_CONNECTION.group(
                gname=group_name
            )  # no such group is returned for utf8 groups like interrobang
            for line in adba_result.datalines:
                if line['shortname']:
                    short_group_list.append(line['shortname'])
                else:
                    if group_name not in short_group_list:
                        short_group_list.append(group_name)
    else:
        short_group_list = group_list
    return short_group_list
Example #10
0
def short_group_names(groups):
    """
    Find AniDB short group names for release groups

    :param groups: list of groups to find short group names for
    :return: list of shortened group names
    """
    groups = groups.split(",")
    shortGroupList = []
    if helpers.set_up_anidb_connection():
        for groupName in groups:
            group = sickbeard.ADBA_CONNECTION.group(gname=groupName)
            for line in group.datalines:
                if line["shortname"]:
                    shortGroupList.append(line["shortname"])
                else:
                    if not groupName in shortGroupList:
                        shortGroupList.append(groupName)
    else:
        shortGroupList = groups
    return shortGroupList
Example #11
0
def short_group_names(groups):
    """
    Find AniDB short group names for release groups

    :param groups: list of groups to find short group names for
    :return: list of shortened group names
    """
    groups = groups.split(",")
    shortGroupList = []
    if helpers.set_up_anidb_connection():
        for groupName in groups:
            group = sickbeard.ADBA_CONNECTION.group(gname=groupName)
            for line in group.datalines:
                if line["shortname"]:
                    shortGroupList.append(line["shortname"])
                else:
                    if not groupName in shortGroupList:
                        shortGroupList.append(groupName)
    else:
        shortGroupList = groups
    return shortGroupList