Esempio n. 1
0
    def test_history_export2(self):

        if os.path.exists(DB_PATH):
            os.remove(DB_PATH)

        sqlstore = SQLStore(DB_PATH)

        lib = Library(sqlstore)
        h = History(sqlstore)

        h.setLogEnabled(True)
        h.setUpdateEnabled(True)
        lib.history = h

        uid = lib.insert(artist="artist1",
                         album='album1',
                         title='title1',
                         path='/path')

        lib.incrementPlaycount(uid)

        records = list(h.export())
        self.assertEqual(len(records), 1)
        record = records[0]
        self.assertEqual(record['uid'], uid)
        self.assertEqual(record['column'], Song.playtime)
Esempio n. 2
0
def main():

    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(True)

    db_path = "./yue.db"
    sqlstore = SQLStore(db_path)
    Library.init(sqlstore)
    PlaylistManager.init(sqlstore)

    #playlist = Library.instance().search("(.abm 0 limited execution)")
    #uids = [s[Song.uid] for s in playlist]

    uids = list(PlaylistManager.instance().openPlaylist("Nexus5x").iter())
    dp = None  # [("limited","limited"),]

    pdialog = SyncProfileDialog()
    if pdialog.exec_():
        s = pdialog.export_settings()
        #s['no_exec'] = True
        sdialog = SyncDialog(uids, s, dp)
        sdialog.start()
        sdialog.show()

    sys.exit(app.exec_())
Esempio n. 3
0
    def test_history_export3(self):
        """
        show that export returns in the correct order
        """
        if os.path.exists(DB_PATH):
            os.remove(DB_PATH)

        sqlstore = SQLStore(DB_PATH)

        lib = Library(sqlstore)
        h = History(sqlstore)

        h.setLogEnabled(True)
        h.setUpdateEnabled(True)
        lib.history = h

        date = timegm(time.localtime(time.time()))

        dates = [date, date + 2, date + 4]
        uid = 0

        with h.sqlstore.conn:
            c = h.sqlstore.conn.cursor()
            for d in dates:
                h.incrementPlaycount(c, uid, d)

        records = list(h.export())
        self.assertEqual(len(records), 3)
        for d, r in zip(dates, records):
            self.assertEqual(r['date'], d)
Esempio n. 4
0
    def test_history_export(self):

        if os.path.exists(DB_PATH):
            os.remove(DB_PATH)

        sqlstore = SQLStore(DB_PATH)

        lib = Library(sqlstore)
        h = History(sqlstore)

        h.setLogEnabled(True)
        h.setUpdateEnabled(True)
        lib.history = h

        date = timegm(time.localtime(time.time()))

        uid = 0

        with h.sqlstore.conn:
            c = h.sqlstore.conn.cursor()
            h.incrementPlaycount(c, uid, date)

        records = list(h.export())
        self.assertEqual(len(records), 1)
        record = records[0]
        self.assertEqual(record['uid'], uid)
        self.assertEqual(record['date'], date)
        self.assertEqual(record['column'], Song.playtime)
Esempio n. 5
0
    def createTargetLibrary(self):
        if self.target_library is not None:
            return self.target_library

        sys.stdout.write("Generating target playlist & library\n")
        new_playlist = self.data.getTargetPlaylist()

        # TODO create local then COPY to target path
        db_path = os.path.join(os.getcwd(), "target.db")
        if os.path.exists(db_path):
            os.remove(db_path)
        sqlstore = SQLStore(db_path)
        library = Library(sqlstore)

        with library.sqlstore.conn:
            c = library.sqlstore.conn.cursor()
            for song in new_playlist:
                if "artist_key" in song:
                    del song['artist_key']
                if self.target_prefix_path:
                    song[Song.path] = self.target_source.join( \
                                      self.target_prefix_path,song[Song.path])
                library._insert(c, **song)

        self.target_library = library

        #db_path = self.getTargetLibraryPath()
        #source_copy_file(self.local_source ...,
        #                    self.target_source, ...)

        sys.stdout.write("finished creating target library\n")

        return library
Esempio n. 6
0
 def copy_remote_settings(self, dbpath, target_library):
     # if a remote database was copied locally, copy
     # the settings from that database to the new database
     # the next step will copy the new database back
     # to the target directory.
     #db_path = os.path.join(os.getcwd(),"remote.db")
     self.log("remote path: %s %s" % (dbpath, os.path.exists(dbpath)))
     if os.path.exists(dbpath):
         remote_sqlstore = SQLStore(dbpath)
         remote_settings = Settings(remote_sqlstore)
         remote_settings['_sync'] = 1  # token setting
         target_settings = Settings(target_library.sqlstore)
         for key, value in remote_settings.items():
             target_settings[key] = value
         remote_sqlstore.close()
         os.remove(dbpath)
Esempio n. 7
0
    def test_library_findpath(self):

        if os.path.exists(DB_PATH):
            os.remove(DB_PATH)

        sqlstore = SQLStore(DB_PATH)
        lib = Library(sqlstore)

        lib.insert(artist="artist1",
                   album='album1',
                   title='title1',
                   path='C:\\path\\to\\file.mp3')
        lib.insert(artist="artist2",
                   album='album2',
                   title='title2',
                   path='C:/path/to/file.mp3')
        lib.insert(artist="artist3",
                   album='album3',
                   title='title3',
                   path='C:/file.mp3')

        # return the one file which is at the root directory
        res = list(lib.searchDirectory("C:\\", False))
        self.assertEqual(len(res), 1)

        # show that the search result is a song dictionary
        self.assertEqual(res[0]['artist'], 'artist3')

        # return all songs, regardless of directory or toothpicks
        res = list(lib.searchDirectory("C:\\", True))
        self.assertEqual(len(res), 3)

        # find a file that matches exactly
        res = list(lib.searchPath("C:\\file.mp3"))
        self.assertEqual(len(res), 1)

        pl = PlaylistManager(sqlstore).openPlaylist("current")
        pl.set([1, 2])

        result = list(lib.searchPlaylist('current'))
        self.assertEqual(len(result), 2)

        result = list(
            lib.searchPlaylist('current',
                               "art = art",
                               invert=False,
                               orderby="artist",
                               reverse=True,
                               limit=1))
        self.assertEqual(result[0]['artist'], 'artist2')

        result = list(lib.searchPlaylist('current', invert=True))
        self.assertEqual(result[0]['artist'], 'artist3')

        result = list(lib.searchPlaylist('current', "art = art", invert=True))
        self.assertEqual(result[0]['artist'], 'artist3')
Esempio n. 8
0
    def test_playlist_shuffle(self):
        sqlstore = SQLStore(DB_PATH)
        pm = PlaylistManager(sqlstore)
        lib = Library(sqlstore)
        pl = pm.openPlaylist(PL_NAME)
        pl.set([1, 2, 3, 4, 5])

        pl.shuffle_range(1, 3)
        # these two values should be the same every time.
        key = pl.get(0)
        self.assertEqual(1, key)
        key = pl.get(4)
        self.assertEqual(5, key)
Esempio n. 9
0
    def test_library_create(self):

        if os.path.exists(DB_PATH):
            os.remove(DB_PATH)

        sqlstore = SQLStore(DB_PATH)
        lib = Library(sqlstore)

        uid = lib.insert(artist="artist1",
                         album='album1',
                         title='title1',
                         path='/path')
        song = lib.songFromId(uid)

        # check required fields
        self.assertEqual(song['artist'], 'artist1')
        self.assertEqual(song['album'], 'album1')
        self.assertEqual(song['title'], 'title1')
        self.assertEqual(song['path'], '/path')
        # check default fields
        self.assertEqual(song['playcount'], 0)

        # both these values should be 1
        artists = list(lib.getArtists())
        self.assertEqual(len(artists), 1)
        art = artists[0]['uid']
        albums = list(lib.getAlbums(art))
        self.assertEqual(len(albums), 1)

        lib.update(uid, artist="The Artist", album="Album", title="Title")

        song = lib.songFromId(uid)

        self.assertEqual(song['artist'], 'The Artist')
        self.assertEqual(song['album'], 'Album')
        self.assertEqual(song['title'], 'Title')

        lib.increment(uid, 'playcount', 5)
        song = lib.songFromId(uid)
        self.assertEqual(song['playcount'], 5)

        lib.increment(uid, 'playcount', -2)
        song = lib.songFromId(uid)
        self.assertEqual(song['playcount'], 3)

        # both these values should be 1, after updating artist,album
        artists = list(lib.getArtists())
        self.assertEqual(len(artists), 1)
        art = artists[0]['uid']
        albums = list(lib.getAlbums(art))
        self.assertEqual(len(albums), 1)
Esempio n. 10
0
def main():

    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(True)

    db_path = "./yue.db"
    sqlstore = SQLStore(db_path)
    Library.init(sqlstore)
    PlaylistManager.init(sqlstore)

    window = OpenPlaylistDialog()
    window.show()

    sys.exit(app.exec_())
Esempio n. 11
0
    def test_playlist_insert_end(self):

        sqlstore = SQLStore(DB_PATH)
        pm = PlaylistManager(sqlstore)
        pl = pm.openPlaylist(PL_NAME)
        pl.set([1, 2, 3, 4, 5])

        size = pl.size()

        value = 10
        pl.insert(size, value)
        self.assertEqual(pl.size(), size + 1)
        new_value = pl.get(size)
        self.assertEqual(new_value, value)
Esempio n. 12
0
def main():

    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(True)


    db_path = "./libimport.db"
    sqlstore = SQLStore(db_path)
    Library.init( sqlstore )

    window = DialogVolEqLearn()
    window.show()


    sys.exit(app.exec_())
Esempio n. 13
0
    def test_playlist_reinsert_simple(self):

        sqlstore = SQLStore(DB_PATH)
        pm = PlaylistManager(sqlstore)
        pl = pm.openPlaylist(PL_NAME)
        pl.set([1, 2, 3, 4, 5])

        pl.reinsert(3, 1)

        expected = [1, 4, 2, 3, 5]
        for i, v in enumerate(expected):
            actual = pl.get(i)
            self.assertEqual(actual, v, "%d %d" % (v, actual))
        idx, key = pl.current()
        self.assertEqual(idx, 0)
        self.assertEqual(key, 1)

        # move current into the middle
        pl.reinsert(0, 2)
        expected = [4, 2, 1, 3, 5]
        for i, v in enumerate(expected):
            actual = pl.get(i)
            self.assertEqual(actual, v, "%d %d" % (v, actual))
        idx, key = pl.current()
        self.assertEqual(idx, 2)
        self.assertEqual(key, 1)

        # move one below current above
        pl.reinsert(4, 0)
        expected = [5, 4, 2, 1, 3]
        actual = []
        for i in range(len(expected)):
            actual.append(pl.get(i))
        self.assertEqual(actual, expected, "%s %s" % (expected, actual))
        idx, key = pl.current()
        self.assertEqual(idx, 3)
        self.assertEqual(key, 1)

        # move one above current below
        pl.reinsert(0, 4)
        expected = [4, 2, 1, 3, 5]
        actual = []
        for i in range(len(expected)):
            actual.append(pl.get(i))
        self.assertEqual(actual, expected, "%s %s" % (expected, actual))
        idx, key = pl.current()
        self.assertEqual(idx, 2)
        self.assertEqual(key, 1)
Esempio n. 14
0
    def test_playlist_append(self):

        sqlstore = SQLStore(DB_PATH)
        pm = PlaylistManager(sqlstore)
        pl = pm.openPlaylist(PL_NAME)
        pl.set([])

        self.assertEqual(pl.size(), 0)

        pl.append(10)
        self.assertEqual(pl.size(), 1)
        self.assertEqual(pl.get(0), 10)

        pl.append(20)
        self.assertEqual(pl.size(), 2)
        self.assertEqual(pl.get(1), 20)
Esempio n. 15
0
    def step(self, idx):

        dbpath = os.path.join(os.getcwd(), "remote.db")
        if not isinstance(self.parent.target_source, DirectorySource):
            # target is not a local directory
            tgtdb = self.parent.getTargetLibraryPath()
            self.parent.log("remote db path: %s" % tgtdb)
            if self.parent.target_source.exists(tgtdb):
                #with self.parent.target_source.open(tgtdb,"rb") as rb:
                #    with self.parent.local_source.open(dbpath,"wb") as wb:
                #        wb.write(rb.read())
                source_copy_file(self.parent.target_source, tgtdb,
                                 self.parent.local_source, dbpath)
        else:
            dbpath = self.parent.getTargetLibraryPath()

        self.remote_path = dbpath

        self.parent.log("db local path: %s %s" %
                        (dbpath, os.path.exists(dbpath)))

        if not self.parent.local_source.exists(dbpath):
            self.parent.log("import history: no database")
            return

        remote_store = SQLStore(dbpath)
        remote_history = History(remote_store)
        local_history = History(self.parent.library.sqlstore)

        size = remote_history.size()
        self.parent.log("import history: num records %d" % size)

        if self.no_exec or size == 0:
            self.parent.log("import history: nothing to do")
            return

        self.execute = self.parent.getYesOrNo("Import %d records?" % size,
                                              btn2="import")

        if not self.execute:
            return

        conn = self.parent.library.sqlstore.conn
        with conn:
            c = conn.cursor()
            for record in remote_history.export():
                self.parent.library._import_record(c, record)
Esempio n. 16
0
    def test_library_delete(self):

        if os.path.exists(DB_PATH):
            os.remove(DB_PATH)

        sqlstore = SQLStore(DB_PATH)
        lib = Library(sqlstore)

        uid = lib.insert(artist="artist1",
                         album='album1',
                         title='title1',
                         path='/path')

        lib.remove(uid)

        with self.assertRaises(KeyError):
            lib.songFromId(uid)
Esempio n. 17
0
def main():

    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(True)

    db_path = "./yue.db"
    sqlstore = SQLStore(db_path)

    window = SettingsDialog()

    names = ["default", "test1"]
    queries = ["length < 14", "woah"]
    window.tab_preset.setData(names, queries)

    window.show()

    sys.exit(app.exec_())
Esempio n. 18
0
def test_history_export():

    # db_path = "/Users/nsetzer/Music/Library/yue.db"
    db_path = "D:\\Dropbox\\ConsolePlayer\\yue.db"
    sqlstore = SQLStore(db_path)
    History.init(sqlstore)

    ts = int((datetime.datetime.now() - datetime.timedelta(28)).timestamp())

    rule = AndSearchRule([
        ExactSearchRule("column", "playtime"),
        GreaterThanEqualSearchRule("date", ts, type_=int)
    ])
    # get all records in the local database
    records = History.instance().export(rule)

    print(records)
Esempio n. 19
0
    def test_playlist_insert_begin(self):

        sqlstore = SQLStore(DB_PATH)
        pm = PlaylistManager(sqlstore)
        pl = pm.openPlaylist(PL_NAME)
        pl.set([1, 2, 3, 4, 5])

        first = pl.get(0)
        size = pl.size()

        value = 10
        pl.insert(0, value)
        self.assertEqual(pl.size(), size + 1)
        new_first = pl.get(0)
        self.assertEqual(new_first, value)
        new_second = pl.get(1)
        self.assertEqual(new_second, first)
Esempio n. 20
0
    def test_history_import_playback(self):

        if os.path.exists(DB_PATH):
            os.remove(DB_PATH)

        sqlstore = SQLStore(DB_PATH)

        lib = Library(sqlstore)
        h = History(sqlstore)

        h.setLogEnabled(True)
        h.setUpdateEnabled(True)
        lib.history = h

        uid = lib.insert(artist="artist1",
                         album='album1',
                         title='title1',
                         path='/path',
                         last_played=100000)

        songb = lib.songFromId(uid)

        record = {
            'date': 50000,
            'uid': uid,
            'column': Song.playtime,
            'value': None
        }

        lib.import_record(record)

        songa = lib.songFromId(uid)

        self.assertEqual(songa[Song.last_played], songb[Song.last_played])
        self.assertEqual(songa[Song.play_count], 1 + songb[Song.play_count])

        new_date = 300000
        record['date'] = new_date
        lib.import_record(record)

        songa = lib.songFromId(uid)

        self.assertNotEqual(songa[Song.frequency], 0)
        self.assertEqual(songa[Song.last_played], new_date)
        self.assertEqual(songa[Song.play_count], 2 + songb[Song.play_count])
Esempio n. 21
0
    def test_history_import_update_int(self):
        """
        create a song, then a record which will update the
        rating

        import the record and verify that the artist name was changed
        successfully
        """
        if os.path.exists(DB_PATH):
            os.remove(DB_PATH)

        sqlstore = SQLStore(DB_PATH)

        lib = Library(sqlstore)
        h = History(sqlstore)

        h.setLogEnabled(True)
        h.setUpdateEnabled(True)
        lib.history = h

        rate1 = 5
        rate2 = 10
        uid = lib.insert(artist="artist1",
                         album='album1',
                         title='title1',
                         rating=rate1,
                         path='/path')

        songb = lib.songFromId(uid)

        record = {
            'date': 0,
            'uid': uid,
            'column': Song.rating,
            'value': "%s" % rate2
        }

        lib.import_record(record)

        songa = lib.songFromId(uid)

        self.assertNotEqual(songb[Song.rating], songa[Song.rating])
        self.assertEqual(songa[Song.rating], rate2)
Esempio n. 22
0
def main():
    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(True)

    db_path = "./yue.db"
    sqlstore = SQLStore(db_path)
    Library.init(sqlstore)
    PlaylistManager.init(sqlstore)

    table = LibraryTree()

    table.refreshData()

    table.container.resize(640, 320)
    table.container.show()
    #table.checkable= True
    #table.setStyleSheet('font-size: 12pt;')

    sys.exit(app.exec_())
Esempio n. 23
0
    def test_playlist_create(self):

        # removing / creating db is slow
        # therefore it is only done for this test

        if os.path.exists(DB_PATH):
            os.remove(DB_PATH)

        sqlstore = SQLStore(DB_PATH)
        pm = PlaylistManager(sqlstore)

        pl = pm.openPlaylist(PL_NAME)

        self.assertEqual(pl.size(), 0)

        data = [1, 2, 3, 4, 5]
        pl.set(data)

        self.assertEqual(pl.size(), len(data))
Esempio n. 24
0
    def test_playlist_delete(self):

        sqlstore = SQLStore(DB_PATH)
        pm = PlaylistManager(sqlstore)
        pl = pm.openPlaylist(PL_NAME)
        pl.set([1, 2, 3, 4, 5])

        # delete first
        pl.delete(0)
        self.assertEqual(pl.get(0), 2)

        # delete last
        pl.delete(pl.size() - 1)
        self.assertEqual(pl.get(pl.size() - 1), 4)

        # delete middle
        pl.delete(pl.size() // 2)
        self.assertEqual(pl.size(), 2)
        self.assertEqual(pl.get(0), 2)
        self.assertEqual(pl.get(1), 4)
Esempio n. 25
0
def main():

    db_path = "./libimport.db"
    sqlstore = SQLStore(db_path)
    Library.init(sqlstore)
    PlaylistManager.init(sqlstore)

    pl = PlaylistManager.instance().openPlaylist("current")
    device = BassSoundDevice(pl, "./lib/win32/x86_64", True)

    songs = Library.instance().search(None, orderby=Song.random, limit=5)
    lst = [s['uid'] for s in songs]
    pl.set(lst)

    print("supports float", BassPlayer.supportsFloat())

    device.setVolume(.25)
    device.play_index(0)

    YueRepl(device=device).repl()
Esempio n. 26
0
def main():

    ffmpeg = r"C:\ffmpeg\bin\ffmpeg.exe"
    db_path = "yue.db"

    #target = "ftp://*****:*****@192.168.0.9:2121/Music"
    target = "test"
    transcode = SyncManager.T_NON_MP3
    equalize = True
    bitrate = 320
    run = True
    no_exec = False
    format = SyncManager.P_M3U
    target_prefix = os.getcwd()

    sqlstore = SQLStore(db_path)
    Library.init(sqlstore)
    PlaylistManager.init(sqlstore)

    library = Library.instance()
    playlist = library.search("(.abm 0 limited execution)")
    uids = [s[Song.uid] for s in playlist]

    print(os.path.realpath(db_path))
    print("lib", len(library))

    dp = [
        ("limited", "limited"),
    ]

    sm = SyncManager(library,
                     uids,
                     target,
                     ffmpeg,
                     transcode=transcode,
                     equalize=equalize,
                     dynamic_playlists=dp,
                     target_prefix=target_prefix,
                     playlist_format=format,
                     no_exec=no_exec)
    sm.run()
Esempio n. 27
0
    def test_playlist_next_prev(self):
        sqlstore = SQLStore(DB_PATH)
        pm = PlaylistManager(sqlstore)
        pl = pm.openPlaylist(PL_NAME)
        pl.set([1, 2, 3, 4, 5])

        idx, key = pl.current()
        self.assertEqual(idx, 0)
        self.assertEqual(key, 1)

        idx, key = pl.next()
        self.assertEqual(idx, 1)
        self.assertEqual(key, 2)

        idx, key = pl.prev()
        self.assertEqual(idx, 0)
        self.assertEqual(key, 1)

        with self.assertRaises(StopIteration):
            pl.prev()

        pl.set_index(4)
        with self.assertRaises(StopIteration):
            pl.next()
Esempio n. 28
0
def _connect():

    # db_path = "/Users/nsetzer/Music/Library/yue.db"
    db_path = "D:\\Dropbox\\ConsolePlayer\\yue.db"
    sqlstore = SQLStore(db_path)
    History.init(sqlstore)
    Library.init(sqlstore)

    username = "******"
    apikey = "f45596be-5355-4cef-bd00-fb63f872b140"

    songs = Library.instance().search("beast")
    song = songs[0]

    api = ApiClient("http://localhost:4200")
    user = api.login("admin", "admin")
    print(user)
    api.setApiUser(username)
    api.setApiKey(user['apikey'])
    apiw = ApiClientWrapper(api)

    songs = apiw.connect()

    return songs, api, apiw
Esempio n. 29
0
    def test_str(self):

        if os.path.exists(DB_PATH):
            os.remove(DB_PATH)

        sqlstore = SQLStore(DB_PATH)
        s = Settings(sqlstore)

        # -------------------------------------------------
        # test inserting/retrieving a string
        key = "strkey"
        val = "strval"
        s[key] = val
        self.assertEqual(s[key], val)

        # show that a string can be overwritten
        val = "foo"
        s[key] = val
        self.assertEqual(s[key], val)

        # can't overwrite an existing value with a different type
        with self.assertRaises(ValueError):
            s[key] = 123

        # -------------------------------------------------
        # test inserting/retrieving an integer
        key = "intkey"
        val = 1474
        s[key] = val
        self.assertEqual(s[key], val)

        # show that an integer can be overwritten
        val = 42
        s[key] = val
        self.assertEqual(s[key], val)

        # can't overwrite an existing value with a different type
        with self.assertRaises(ValueError):
            s[key] = "string"

        # -------------------------------------------------
        # test inserting/retrieving a list
        key = "csvkey"
        val = ["a", "b", "c"]
        s[key] = val
        self.assertEqual(s[key], val)

        # show that a list can be overwritten
        val = [
            "a",
        ]
        s[key] = val
        self.assertEqual(s[key], val)

        # can't overwrite an existing value with a different type
        with self.assertRaises(ValueError):
            s[key] = 123

        # -------------------------------------------------
        # setDefault only update if the key does not yet exist
        key = "default"
        val = "value"
        s.setDefault(key, val)
        self.assertEqual(s[key], val)
        s.setDefault(key, "new value")
        self.assertEqual(s[key], val)

        self.assertEqual(len(list(s.keys())), 4)
Esempio n. 30
0
def initSettings(path_base):

    if not os.path.exists(path_base):
        os.makedirs(path_base)

    settings_db_path = os.path.join(path_base,"settings.db")

    sqlstore = SQLStore(settings_db_path)
    Settings.init( sqlstore )

    Settings.instance()['database_directory']=path_base

    data = {}

    # basic associations by extension
    # TODO: pull the defaults out the resource manager,
    # settings menu can modify these (and update resource manager)
    fAssoc = ResourceManager.instance().getFileAssociation

    # TODO: resource manager doesnt keep track of text files, should it?
    data['ext_text'] = [".txt",".log",".md",]

    data['ext_archive']  = fAssoc(ResourceManager.ARCHIVE)
    data['ext_image']    = fAssoc(ResourceManager.IMAGE)
    data['ext_audio']    = fAssoc(ResourceManager.SONG);
    data['ext_movie']    = fAssoc(ResourceManager.MOVIE)
    data['ext_document'] = fAssoc(ResourceManager.DOCUMENT)
    data['ext_code']     = fAssoc(ResourceManager.CODE)

    if sys.platform == 'darwin':
        cmd_edit_text = "\"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl\" \"%s\""
        cmd_edit_image = ""
        cmd_open_native = "open \"%s\""
        cmd_launch_terminal = "open -b com.apple.terminal \"%s\""
        cmd_diff_files = "\"/Applications/Beyond Compare.app/Contents/MacOS/bcomp\" \"%s\" \"%s\""
        cmd_play_audio = "/Applications/VLC.app/Contents/MacOS/VLC \"%s\""
        cmd_play_video = "/Applications/VLC.app/Contents/MacOS/VLC \"%s\""
        cmd_vagrant = "vagrant"
    elif sys.platform=="win32":

        cmd_edit_text = "\"C:\\Program Files\\Sublime Text 3\\subl.exe\" \"%s\""
        #cmd_edit_image = "mspaint.exe \"%s\""
        cmd_edit_image = "pythonw \"D:\\Dropbox\\Code\\packages\\PyPaint\\PyPaint.py\" \"%s\""
        cmd_open_native = "explorer \"%s\""
        cmd_launch_terminal = "start /D \"%s\""
        cmd_diff_files = ""
        cmd_play_audio = ""
        cmd_play_video = ""
        cmd_vagrant = ""
    else:
        cmd_edit_text = "subl3 \"%s\""
        cmd_edit_image = ""
        # nemo caja thunar dolphin
        cmd_open_native = "nemo \"%s\""
        cmd_launch_terminal = "xterm -e \"cd %s; bash\""
        cmd_diff_files = ""
        cmd_play_audio = ""
        cmd_play_video = ""
        cmd_vagrant = ""

    data["cmd_edit_text"] = cmd_edit_text
    data["cmd_edit_image"] = cmd_edit_image
    data["cmd_open_native"] = cmd_open_native
    data["cmd_launch_terminal"] = cmd_launch_terminal
    data["cmd_diff_files"] = cmd_diff_files
    data["cmd_play_audio"] = cmd_play_audio
    data["cmd_play_video"] = cmd_play_video
    data["cmd_vagrant"] = cmd_vagrant

    # view_show_hidden is the default value for new tabs
    # each widget supports an individual setting, which can be toggled.
    data['view_show_hidden'] = True

    Settings.instance().setMulti(data,False)