Beispiel #1
0
    def testDisplay(self):
        self.g.exists = self.always_exists
        self.g.suffix = ".ogg"
        #self.g.folder = "/")

        self.s = SoundFile("ssh:user@server:port///path/to/file.flac")
        self.failUnlessEqual(self.s.filename_for_display, "file.flac")
        self.s = SoundFile("ssh:user@server:port///path/to/fîlé.flac")
        self.failUnlessEqual(self.s.filename_for_display, u"fîlé.flac")
        self.s = SoundFile("ssh:user@server:port///path/to/\xaa.flac")
        self.failUnlessEqual(self.s.filename_for_display, u"\ufffd.flac")
Beispiel #2
0
 def testLocationEscape(self):
     self.s = SoundFile("/path/to/file with spaces")
     self.g.replace_messy_chars = False
     self.g.suffix = ".ogg"
     self.g.folder = "/mu sic"
     self.failUnlessEqual(self.g.get_target_name(self.s),
                          "/mu%20sic/file%20with%20spaces.ogg")
Beispiel #3
0
 def testRoot(self):
     self.s = SoundFile("/path/to/file.flac", "/path/")
     self.s.tags.update({
         "artist": "Foo Bar",
         "title": "Hi Ho",
         "album": "IS: TOO",
         "track-number": 1L,
         "track-count": 11L,
     })
     self.g.suffix = ".ogg"
     self.failUnlessEqual(self.g.get_target_name(self.s),
                          "/path/to/file.ogg")
Beispiel #4
0
    def setUp(self):
        self.g = TargetNameGenerator()
        self.g.exists = self.never_exists
        self.g.replace_messy_chars = True

        self.s = SoundFile("/path/to/file.flac")
        self.s.tags.update({
            "artist": "Foo Bar",
            "title": "Hi Ho",
            "album": "IS: TOO",
            "track-number": 1L,
            "track-count": 11L,
        })
Beispiel #5
0
 def testQuote(self):
     self.s = SoundFile(quote("/path%/to/file%.flac"))
     self.s.tags.update({
         "artist": "Foo%Bar",
         "title": "Hi%Ho",
     })
     self.g.replace_messy_chars = False
     self.g.suffix = ".ogg"
     self.failUnlessEqual(self.g.get_target_name(self.s),
                          quote("/path%/to/file%.ogg"))
     self.g.subfolders = "%(artist)s"
     self.g.basename = "%(title)s"
     self.failUnlessEqual(self.g.get_target_name(self.s),
                          quote("/path%/to/Foo%Bar/Hi%Ho.ogg"))
Beispiel #6
0
 def testRootPathCustomPattern(self):
     self.s = SoundFile("/path/to/file.flac", "/path/")
     self.s.tags.update({
         "artist": "Foo Bar",
         "title": "Hi Ho",
         "album": "IS: TOO",
         "track-number": 1L,
         "track-count": 11L,
     })
     self.g.suffix = ".ogg"
     self.g.folder = "/music"
     self.g.basename = "%(title)s"
     self.failUnlessEqual(self.g.get_target_name(self.s),
                          "/music/to/Hi%20Ho.ogg")
Beispiel #7
0
    def testURILocalDestination(self):
        self.g.exists = self.always_exists
        self.g.suffix = ".ogg"
        self.g.folder = "/music"

        self.s = SoundFile("ssh:user@server:port///path/to/file.flac")
        self.s.tags.update({
            "artist": "Foo Bar",
            "title": "Hi Ho",
            "album": "IS: TOO",
            "track-number": 1L,
            "track-count": 11L,
        })
        self.failUnlessEqual(self.g.get_target_name(self.s), "/music/file.ogg")
Beispiel #8
0
 def test8bits_tags(self):
     self.g.replace_messy_chars = False
     self.s = SoundFile("/path/to/fileyop.flac")
     self.s.tags.update({
         "artist": "\xa0\xb0\xc0\xd0",
         "title": "\xa1\xb1\xc1\xd1",
         "album": "\xa2\xb2\xc2\xd2",
         "track-number": 1L,
         "track-count": 11L,
     })
     self.g.suffix = ".ogg"
     self.g.folder = "/music"
     self.g.subfolders = "%(artist)s/%(album)s"
     self.g.basename = "%(title)s"
     self.failUnlessEqual(
         self.g.get_target_name(self.s),
         quote(
             "/music/\xa0\xb0\xc0\xd0/\xa2\xb2\xc2\xd2/\xa1\xb1\xc1\xd1.ogg"
         ))
Beispiel #9
0
    def testURIUnicodeMessy(self):
        self.g.exists = self.always_exists
        self.g.suffix = ".ogg"
        self.g.folder = "ftp:user2@dest-server:another-port:" + quote(
            "/mûsîc/")

        self.s = SoundFile("ssh:user@server:port" +
                           quote(u"///path/to/file with strângë chàrs.flac"))
        self.s.tags.update({
            "artist": "Foo Bar",
            "title": "Hi Ho",
            "album": "IS: TOO",
            "track-number": 1L,
            "track-count": 11L,
        })
        self.failUnlessEqual(
            self.g.get_target_name(self.s),
            "ftp:user2@dest-server:another-port:/" + quote("mûsîc") +
            "/file%20with%20str%C3%A2ng%C3%AB%20ch%C3%A0rs.ogg")
Beispiel #10
0
    def testURIUnicode_utf8(self):
        self.g.exists = self.always_exists
        self.g.suffix = ".ogg"
        self.g.folder = "ftp:user2@dest-server:another-port:" + quote(
            "/mûsîc/")
        self.g.replace_messy_chars = False

        self.s = SoundFile("ssh:user@server:port" +
                           quote("///path/to/file with strângë chàrs фズ.flac"))
        self.s.tags.update({
            "artist": "Foo Bar",
            "title": "Hi Ho",
            "album": "IS: TOO",
            "track-number": 1L,
            "track-count": 11L,
        })
        self.failUnlessEqual(
            self.g.get_target_name(self.s),
            "ftp:user2@dest-server:another-port:" +
            quote("/mûsîc/file with strângë chàrs фズ.ogg"))
Beispiel #11
0
 def testNoExtension(self):
     self.g.suffix = ".ogg"
     self.s = SoundFile("/path/to/file")
     self.failUnlessEqual(self.g.get_target_name(self.s),
                          "/path/to/file.ogg")
Beispiel #12
0
 def test8bits_messy(self):
     self.s = SoundFile(quote("/path/to/file\xa0\xb0A\xc0\xd0.flac"))
     self.g.suffix = ".ogg"
     self.g.replace_messy_chars = True
     self.failUnlessEqual(self.g.get_target_name(self.s),
                          "/path/to/file__A__.ogg")