MCPcopy Create free account
hub / github.com/Syncplay/syncplay / addFileToPlaylist

Method addFileToPlaylist

syncplay/ui/gui.py:2018–2034  ·  view source on GitHub ↗
(self, filePath, index=-1)

Source from the content-addressed store, hash-verified

2016 self.playlist.setPlaylistIndexFilename(filename)
2017
2018 def addFileToPlaylist(self, filePath, index=-1):
2019 if not isURL(filePath):
2020 self.removePlaylistNote()
2021 filename = os.path.basename(filePath)
2022 if self.noPlaylistDuplicates(filename):
2023 if self.playlist == -1 or index == -1:
2024 self.playlist.addItem(filename)
2025 else:
2026 self.playlist.insertItem(index, filename)
2027 self._syncplayClient.fileSwitch.notifyUserIfFileNotInMediaDirectory(filename, filePath)
2028 else:
2029 self.removePlaylistNote()
2030 if self.noPlaylistDuplicates(filePath):
2031 if self.playlist == -1 or index == -1:
2032 self.playlist.addItem(filePath)
2033 else:
2034 self.playlist.insertItem(index, filePath)
2035
2036 def openFile(self, filePath, resetPosition=False, fromUser=False):
2037 self._syncplayClient.openFile(filePath, resetPosition, fromUser=fromUser)

Callers 3

dropEventMethod · 0.45
dropEventMethod · 0.45

Calls 4

removePlaylistNoteMethod · 0.95
noPlaylistDuplicatesMethod · 0.95
isURLFunction · 0.90

Tested by

no test coverage detected