Ejemplo n.º 1
0
    def _cp_dispatch(self, vpath):
        """cp dispatcher overwrite"""
        user = 0
        if len(vpath) == 0:
            return self

        section = ""
        api_key = vpath.pop(0)
        if len(api_key) == 40:
            user = self._check_api_key(api_key)
            if len(vpath) == 0:
                return self
            section = vpath.pop(0).lower()
        else:
            user = Auth.check_logged_in()
            section = api_key.lower()

        cherrypy.request.params["user"] = user

        if section == "admin":
            return APIAdmin()
        if section == "library":
            return APILibrary()
        if section == "ripper":
            return APIRipper()
        if section == "scraper":
            return APIScraper()
        return API404()
Ejemplo n.º 2
0
    def _cp_dispatch(self, vpath):
        """cp dispatcher overwrite"""

        if not CONFIG["ripper"]["drives"]["enabled"].value or len(vpath) == 0:
            return self

        section = vpath.pop(0).lower()

        if section == "data":
            return APIRipperDrivesData()
        return API404()
Ejemplo n.º 3
0
    def _cp_dispatch(self, vpath):
        """cp dispatcher overwrite"""
        if len(vpath) == 0:
            return self

        if len(vpath) == 1:
            section = vpath.pop(0)
            if section == "scan":
                return self
            if section == "check":
                return self
            if section == "list":
                return self

        return API404()
Ejemplo n.º 4
0
    def _cp_dispatch(self, vpath):
        """cp dispatcher overwrite"""

        if not CONFIG["ripper"]["enabled"].value or len(vpath) == 0:
            return self

        section = vpath.pop(0).lower()

        if section == "data":
            return APIRipperData()
        if section == "disc":
            return APIRipperDisc()
        if section == "drives":
            return APIRipperDrives()
        if section == "iso":
            return APIRipperIsos()
        if section == "videoconverter":
            return APIRipperVideoConverter()
        return API404()
Ejemplo n.º 5
0
    def _cp_dispatch(self, vpath):
        """cp dispatcher overwrite"""
        if len(vpath) == 0:
            return self

        section = vpath.pop(0).lower()

        if section == "searchmovie":
            return APIScraperSearchMovie()
        if section == "searchtv":
            return APIScraperSearchTV()
        if section == "imdbid":
            return APIScraperIMDBID()
        if section == "tvdbid":
            return APIScraperTVDBID()
        if section == "movietmdbid":
            return APIScraperMovieTMDBID()
        if section == "tvtmdbid":
            return APIScraperTVTMDBID()
        return API404()
Ejemplo n.º 6
0
    def _cp_dispatch(self, vpath):
        """cp dispatcher overwrite"""
        if len(vpath) == 0:
            return self

        self._check_user(True)

        section = vpath.pop(0)
        if section == "reboot":
            cherrypy.request.params["action"] = "reboot"
        elif section == "shutdown":
            cherrypy.request.params["action"] = "shutdown"
        elif section == "config":
            return APIAdminConfig()
        elif section == "userAdd":
            return APIAdminUserAdd()
        elif section == "userDelete":
            return APIAdminUserDelete()
        elif section == "userUpdate":
            return APIAdminUserUpdate()
        return API404()
Ejemplo n.º 7
0
    def _cp_dispatch(self, vpath):
        """cp dispatcher overwrite"""

        if len(vpath) == 0:
            return self
        section = vpath.pop(0).lower()
        if section == "blankdisc":
            return APIRipperDiscBlank()
        if section == "blanktrack":
            return APIRipperTrackBlank()
        if section == "disctypeselect":
            return APIRipperDiscDiscTypeSelect()
        if section == "tracktypeselect":
            return APIRipperDiscTrackTypeSelect()
        if section == "save":
            return APIRipperDiscSave()
        if section == "lock":
            return APIRipperDiscLock()
        if section == "upload":
            return APIRipperDiscUpload()
        if section == "searchapi":
            return APIRipperDiscSearchData()
        return API404()