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

Method loadPlaylistFromFile

syncplay/client.py:2017–2027  ·  view source on GitHub ↗
(self, path, shuffle=False)

Source from the content-addressed store, hash-verified

2015 return filename
2016
2017 def loadPlaylistFromFile(self, path, shuffle=False):
2018 if not os.path.isfile(path):
2019 self._ui.showDebugMessage("Not loading {} as file could not be found".format(path))
2020 return
2021
2022 with open(path) as f:
2023 newPlaylist = f.read().splitlines()
2024 if shuffle:
2025 random.shuffle(newPlaylist)
2026 if newPlaylist:
2027 self.changePlaylist(newPlaylist, username=None, resetIndex=True)
2028
2029 def savePlaylistToFile(self, path):
2030 with open(path, 'w') as playlistFile:

Callers 3

openFileMethod · 0.80
connectedMethod · 0.80

Calls 2

changePlaylistMethod · 0.95
showDebugMessageMethod · 0.45

Tested by

no test coverage detected