Example #1
0
 def write(self):
     with open(self.filename, "wb") as f:
         for song in self._list:
             if isinstance(song, basestring):
                 f.write(fsnative2bytes(song) + "\n")
             else:
                 f.write(fsnative2bytes(song("~filename")) + "\n")
Example #2
0
 def write(self):
     fn = self.filename
     with open(fn, "wb") as f:
         for song in self._list:
             if isinstance(song, basestring):
                 f.write(fsnative2bytes(song) + "\n")
             else:
                 f.write(fsnative2bytes(song("~filename")) + "\n")
     if self._last_fn != fn:
         self.__delete_file(self._last_fn)
         self._last_fn = fn
Example #3
0
    def test_main(self):
        v = fsnative(u"foo")
        self.assertTrue(is_fsnative(v))

        v2 = glib2fsnative(fsnative2glib(v))
        self.assertTrue(is_fsnative(v2))
        self.assertEqual(v, v2)

        v3 = bytes2fsnative(fsnative2bytes(v))
        self.assertTrue(is_fsnative(v3))
        self.assertEqual(v, v3)
Example #4
0
def set_scan_dirs(dirs):
    if sys.platform == "win32":
        joined = fsnative(u":").join(dirs)
    else:
        joined = join_escape(dirs, fsnative(u":"))
    config.set("settings", "scan", fsnative2bytes(joined))