Exemplo n.º 1
0
 def __destroy(self):
     config.save()
     new_dirs = set(get_scan_dirs())
     gone_dirs = set(self.current_scan_dirs) - new_dirs
     if new_dirs - set(self.current_scan_dirs):
         print_d("Library paths have been added, re-scanning...")
         scan_library(app.library, force=False)
     elif gone_dirs:
         copool.add(app.librarian.remove_roots, gone_dirs)
Exemplo n.º 2
0
    def plugin_on_changed(self, songs):
        song = songs[0]
        current_location = song("~filename")
        file_split = os.path.splitext(current_location)
        file_extension = file_split[1]
        psbl_new_location = os.path.abspath(
            os.path.expanduser((Pattern(self.config_get(self.CFG_PAT_PLAYING,
                                                        self.DEFAULT_PAT)) %
                                song) + file_extension))

        if(not(psbl_new_location == re.sub(" \\([0-9]+\\)$",
                                           "",
                                           file_split[0]) + file_extension)):
            dirname = os.path.dirname(psbl_new_location)
            if not os.path.exists(dirname):
                os.makedirs(dirname)

            if os.path.isfile(psbl_new_location):
                num_to_use = 1
                start_with = os.path.splitext(
                    os.path.basename(psbl_new_location))[0]
                length_chk = len(start_with) + 2

                for f in sorted(os.listdir(dirname)):
                    if f.startswith(start_with):
                        temporary = f[length_chk:]

                        if temporary[:temporary.find(")")] == str(num_to_use):
                            num_to_use += 1

                psbl_new_location = os.path.join(dirname,
                                                 start_with +
                                                 " (" + str(num_to_use) + ")" +
                                                 file_extension)

            try:
	            shutil.move(current_location, os.path.normpath(psbl_new_location))

	            self.removeEmptyDirs(os.path.dirname(current_location))

	            scan_library(app.library, False)
            except Exception:
Exemplo n.º 3
0
 def __destroy(self):
     config.write(const.CONFIG)
     if self.current_scan_dirs != get_scan_dirs():
         scan_library(app.library, force=False)
Exemplo n.º 4
0
 def reload_cb(button):
     scan_library(app.library, force=True)
Exemplo n.º 5
0
 def refresh_cb(button):
     scan_library(app.library, force=False)
Exemplo n.º 6
0
def _refresh(app):
    scan_library(app.library, False)
Exemplo n.º 7
0
def _refresh(app):
    scan_library(app.library, False)
Exemplo n.º 8
0
 def __destroy(self):
     config.save()
     if self.current_scan_dirs != get_scan_dirs():
         scan_library(app.library, force=False)
Exemplo n.º 9
0
 def reload_cb(button):
     scan_library(app.library, force=True)
Exemplo n.º 10
0
 def refresh_cb(button):
     scan_library(app.library, force=False)
Exemplo n.º 11
0
 def __rebuild(self, activator, force):
     scan_library(self.__library, force)
Exemplo n.º 12
0
 def __destroy(self):
     config.save()
     if self.current_scan_dirs != get_scan_dirs():
         print_d("Library paths have changed, re-scanning...")
         scan_library(app.library, force=False)
Exemplo n.º 13
0
 def __destroy(self):
     config.save()
     if self.current_scan_dirs != get_scan_dirs():
         print_d("Library paths have changed, re-scanning...")
         scan_library(app.library, force=False)
Exemplo n.º 14
0
 def __destroy(self):
     config.save()
     if self.current_scan_dirs != get_scan_dirs():
         scan_library(app.library, force=False)
Exemplo n.º 15
0
 def __rebuild(self, activator, force):
     scan_library(self.__library, force)
Exemplo n.º 16
0
 def __destroy(self):
     config.write(const.CONFIG)
     if self.current_scan_dirs != get_scan_dirs():
         scan_library(app.library, force=False)