Ejemplo n.º 1
0
 def test_pouet_party_needs_query_params(self):
     forever2e3 = Party.objects.get(name='Forever 2e3')
     link = PartyExternalLink(party=forever2e3)
     link.url = 'https://www.pouet.net/party.php?when=2000'
     self.assertEqual(link.link_class, 'BaseUrl')
     self.assertEqual(link.parameter,
                      'https://www.pouet.net/party.php?when=2000')
Ejemplo n.º 2
0
 def test_sceneorg_folder(self):
     forever2e3 = Party.objects.get(name='Forever 2e3')
     link = PartyExternalLink(party=forever2e3)
     link.url = 'ftp://ftp.scene.org/pub/parties/2000/forever00'
     self.assertEqual(link.link_class, 'SceneOrgFolder')
     self.assertEqual(link.parameter, '/parties/2000/forever00/')
     self.assertEqual(
         str(link.link),
         'https://files.scene.org/browse/parties/2000/forever00/')
Ejemplo n.º 3
0
    def handle_noargs(self, **options):
        for link in PartyExternalLink.objects.filter(
                link_class='BitworldParty'):
            conn = httplib.HTTPConnection("bitworld.bitfellas.org")
            conn.request("GET", "/party.php?id=%s" % link.parameter)
            response = conn.getresponse()
            if response.status == 301:
                new_link = PartyExternalLink(party_id=link.party_id)
                new_link.url = response.getheader('Location')
                try:
                    sid = transaction.savepoint()
                    new_link.save()
                    transaction.savepoint_commit(sid)
                    print "added url %s for party id %d" % (new_link.url,
                                                            new_link.party_id)
                except IntegrityError:
                    # this link duplicates an existing one - we just didn't recognise it
                    # until now due to different link formats. Fair game to delete it
                    transaction.savepoint_rollback(sid)
                    print "%s already exists - skipping" % (new_link.url)

            else:
                print "Unexpected response status code %d - skipping" % response.status
            conn.close()
            sleep(1)

        for link in ProductionLink.objects.filter(link_class='BitworldDemo'):
            conn = httplib.HTTPConnection("bitworld.bitfellas.org")
            conn.request("GET", "/demo.php?id=%s" % link.parameter)
            response = conn.getresponse()
            if response.status == 301:
                new_link = ProductionLink(production_id=link.production_id)
                new_link.url = response.getheader('Location')
                try:
                    sid = transaction.savepoint()
                    new_link.save()
                    transaction.savepoint_commit(sid)
                    print "added url %s for prod id %d" % (
                        new_link.url, new_link.production_id)
                except IntegrityError:
                    # this link duplicates an existing one - we just didn't recognise it
                    # until now due to different link formats. Fair game to delete it
                    transaction.savepoint_rollback(sid)
                    print "%s already exists - skipping" % (new_link.url)

            else:
                print "Unexpected response status code %d - skipping" % response.status
            conn.close()
            sleep(1)
Ejemplo n.º 4
0
    def handle_noargs(self, **options):
        for link in PartyExternalLink.objects.filter(link_class="BitworldParty"):
            conn = httplib.HTTPConnection("bitworld.bitfellas.org")
            conn.request("GET", "/party.php?id=%s" % link.parameter)
            response = conn.getresponse()
            if response.status == 301:
                new_link = PartyExternalLink(party_id=link.party_id)
                new_link.url = response.getheader("Location")
                try:
                    sid = transaction.savepoint()
                    new_link.save()
                    transaction.savepoint_commit(sid)
                    print "added url %s for party id %d" % (new_link.url, new_link.party_id)
                except IntegrityError:
                    # this link duplicates an existing one - we just didn't recognise it
                    # until now due to different link formats. Fair game to delete it
                    transaction.savepoint_rollback(sid)
                    print "%s already exists - skipping" % (new_link.url)

            else:
                print "Unexpected response status code %d - skipping" % response.status
            conn.close()
            sleep(1)

        for link in ProductionLink.objects.filter(link_class="BitworldDemo"):
            conn = httplib.HTTPConnection("bitworld.bitfellas.org")
            conn.request("GET", "/demo.php?id=%s" % link.parameter)
            response = conn.getresponse()
            if response.status == 301:
                new_link = ProductionLink(production_id=link.production_id)
                new_link.url = response.getheader("Location")
                try:
                    sid = transaction.savepoint()
                    new_link.save()
                    transaction.savepoint_commit(sid)
                    print "added url %s for prod id %d" % (new_link.url, new_link.production_id)
                except IntegrityError:
                    # this link duplicates an existing one - we just didn't recognise it
                    # until now due to different link formats. Fair game to delete it
                    transaction.savepoint_rollback(sid)
                    print "%s already exists - skipping" % (new_link.url)

            else:
                print "Unexpected response status code %d - skipping" % response.status
            conn.close()
            sleep(1)
Ejemplo n.º 5
0
    def test_atariki_entry(self):
        pondlife = Production.objects.get(title='Pondlife')
        link = ProductionLink(production=pondlife, is_download_link=False)

        link.url = 'http://atariki.krap.pl/index.php/Cool_Emotion'
        self.assertEqual(link.link_class, 'AtarikiEntry')
        self.assertEqual(str(link.link),
                         'http://atariki.krap.pl/index.php/Cool_Emotion')

        gasman = Releaser.objects.get(name='Gasman')
        link = ReleaserExternalLink(releaser=gasman)

        link.url = 'http://atariki.krap.pl/index.php/Ars'
        self.assertEqual(link.link_class, 'AtarikiEntry')

        forever2e3 = Party.objects.get(name='Forever 2e3')
        link = PartyExternalLink(party=forever2e3)
        link.url = 'http://atariki.krap.pl/index.php/Lato_Ludzik%C3%B3w_1999'
        self.assertEqual(link.link_class, 'AtarikiEntry')
Ejemplo n.º 6
0
 def test_fujiology_folder(self):
     forever2e3 = Party.objects.get(name='Forever 2e3')
     link = PartyExternalLink(party=forever2e3)
     link.url = 'ftp://fujiology.untergrund.net/users/ltk_tscc/fujiology/parties/2000/forever00'
     self.assertEqual(link.link_class, 'FujiologyFolder')
     self.assertEqual(link.parameter, '/parties/2000/forever00/')