示例#1
0
def Initialize():
    Settings.LoadSettings()

    MyGlobals.InitializeGlobals(Settings.WorkingPath)

    if not Settings.VerifyPaths():
        return False

    return True
示例#2
0
def Main(argv):
    print "PtpUploader Release Description Maker by TnS"

    if len(argv) <= 1:
        print "Usage:"
        print "\"ReleaseInfoMaker.py <target directory or filename>\" creates the release description and starts seeding the torrent."
        print "\"ReleaseInfoMaker.py --notorrent <target directory or filename>\" creates the release description."
        print "\"ReleaseInfoMaker.py --noscreens <target directory or filename>\" creates the release description without screens and starts seeding the torrent."
        return

    print ""

    Settings.LoadSettings()
    MyGlobals.InitializeGlobals(Settings.WorkingPath)

    if len(argv) == 2:
        releaseInfoMaker = ReleaseInfoMaker(argv[1])
        releaseInfoMaker.MakeReleaseInfo()
    elif len(argv) == 3 and argv[1] == "--notorrent":
        releaseInfoMaker = ReleaseInfoMaker(argv[2])
        releaseInfoMaker.MakeReleaseInfo(createTorrent=False)
    elif len(argv) == 3 and argv[1] == "--noscreens":
        releaseInfoMaker = ReleaseInfoMaker(argv[2])
        releaseInfoMaker.MakeReleaseInfo(createScreens=False)
示例#3
0
文件: Notifier.py 项目: Aniverse/p1
    settingsDirectory, moduleFilename = os.path.split(
        __file__
    )  # __file__ contains the full path of the current running module
    settingsPath = os.path.join(settingsDirectory, "Notifier.ini")
    fp = open(settingsPath, "r")
    configParser.readfp(fp)
    fp.close()

    return configParser.get("Settings", "UserId")


def Notify(releaseName, uploadedTorrentUrl):
    logger = MyGlobals.Logger

    userId = LoadNotifierSettings()
    userId = userId.strip()
    if not userId.isdigit():
        return

    Ptp.Login()
    subject = "[PtpUploader] %s" % releaseName
    message = "This is an automatic notification about a new [url=%s]upload[/url]." % uploadedTorrentUrl
    Ptp.SendPrivateMessage(userId, subject, message)


if __name__ == "__main__":
    Settings.LoadSettings()
    MyGlobals.InitializeGlobals(Settings.WorkingPath)

    if len(sys.argv) == 3:
        Notify(sys.argv[1], sys.argv[2])