Remove dropFileAddsToPlaylist for now
This commit is contained in:
parent
e6238a54ee
commit
ec3bb067f3
@ -117,9 +117,6 @@ class SyncplayClient(object):
|
|||||||
self.autoPlay = False
|
self.autoPlay = False
|
||||||
self.autoPlayThreshold = None
|
self.autoPlayThreshold = None
|
||||||
|
|
||||||
self.ignorePath = None
|
|
||||||
self.ignorePathTime = None
|
|
||||||
|
|
||||||
self.autoplayTimer = task.LoopingCall(self.autoplayCountdown)
|
self.autoplayTimer = task.LoopingCall(self.autoplayCountdown)
|
||||||
self.autoplayTimeLeft = constants.AUTOPLAY_DELAY
|
self.autoplayTimeLeft = constants.AUTOPLAY_DELAY
|
||||||
|
|
||||||
@ -448,11 +445,6 @@ class SyncplayClient(object):
|
|||||||
return self._globalPaused
|
return self._globalPaused
|
||||||
|
|
||||||
def updateFile(self, filename, duration, path):
|
def updateFile(self, filename, duration, path):
|
||||||
if self.ignorePath == path and self.ignorePathTime is not None and abs(time.time() - self.ignorePathTime) < 5.0:
|
|
||||||
self.ignorePath = None
|
|
||||||
self.ignorePathTime = None
|
|
||||||
return
|
|
||||||
|
|
||||||
newPath = u""
|
newPath = u""
|
||||||
if utils.isURL(path):
|
if utils.isURL(path):
|
||||||
try:
|
try:
|
||||||
@ -469,28 +461,6 @@ class SyncplayClient(object):
|
|||||||
size = os.path.getsize(path)
|
size = os.path.getsize(path)
|
||||||
except:
|
except:
|
||||||
size = 0
|
size = 0
|
||||||
|
|
||||||
def _fileOpenedFromPlayer():
|
|
||||||
return self.sharedPlaylistIsEnabled and self._config['dropFileAddsToPlaylist'] and not utils.isURL(path) and filename <> self.playlist.lastFileOpened and not filename in self.playlist._playlist
|
|
||||||
|
|
||||||
if _fileOpenedFromPlayer():
|
|
||||||
oldFilePath = self.userlist.currentUser.file['path'] if self.userlist.currentUser.file else None
|
|
||||||
self.ignorePath = deepcopy(oldFilePath)
|
|
||||||
self.ignorePathTime = time.time()
|
|
||||||
if not self.playlist._playlist and self.userlist.currentUser.file:
|
|
||||||
if utils.isURL(oldFilePath):
|
|
||||||
self.playlist.addFileToPlaylist(oldFilePath)
|
|
||||||
else:
|
|
||||||
self.playlist.addFileToPlaylist(os.path.basename(oldFilePath))
|
|
||||||
self.playlist.addFileToPlaylist(filename)
|
|
||||||
if self.userlist.currentUser.file:
|
|
||||||
self._player.openFile(oldFilePath)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
self.playlist.lastFileOpened = filename
|
|
||||||
|
|
||||||
# TODO: Cancel if new same as old?
|
|
||||||
|
|
||||||
if not utils.isURL(path) and os.path.exists(path):
|
if not utils.isURL(path) and os.path.exists(path):
|
||||||
self.fileSwitch.notifyUserIfFileNotInMediaDirectory(filename, path)
|
self.fileSwitch.notifyUserIfFileNotInMediaDirectory(filename, path)
|
||||||
filename, size = self.__executePrivacySettings(filename, size)
|
filename, size = self.__executePrivacySettings(filename, size)
|
||||||
@ -532,7 +502,7 @@ class SyncplayClient(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def openFile(self, filePath, resetPosition=False):
|
def openFile(self, filePath, resetPosition=False):
|
||||||
self.playlist.openedFile(filePath)
|
self.playlist.openedFile()
|
||||||
self._player.openFile(filePath, resetPosition)
|
self._player.openFile(filePath, resetPosition)
|
||||||
if resetPosition:
|
if resetPosition:
|
||||||
self.establishRewindDoubleCheck()
|
self.establishRewindDoubleCheck()
|
||||||
@ -1454,7 +1424,6 @@ class SyncplayPlaylist():
|
|||||||
self._playlistIndex = None
|
self._playlistIndex = None
|
||||||
self.addedChangeListCallback = False
|
self.addedChangeListCallback = False
|
||||||
self._lastPlaylistIndexChange = time.time()
|
self._lastPlaylistIndexChange = time.time()
|
||||||
self.lastFileOpened = os.path.basename(self._client._config['file']) if self._client._config['file'] and not utils.isURL(self._client._config['file']) else None
|
|
||||||
|
|
||||||
def needsSharedPlaylistsEnabled(f): # @NoSelf
|
def needsSharedPlaylistsEnabled(f): # @NoSelf
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
@ -1465,12 +1434,8 @@ class SyncplayPlaylist():
|
|||||||
return f(self, *args, **kwds)
|
return f(self, *args, **kwds)
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
def openedFile(self, filePath):
|
def openedFile(self):
|
||||||
self._lastPlaylistIndexChange = time.time()
|
self._lastPlaylistIndexChange = time.time()
|
||||||
if utils.isURL(filePath):
|
|
||||||
self.lastFileOpened = None
|
|
||||||
return
|
|
||||||
self.lastFileOpened = os.path.basename(filePath)
|
|
||||||
|
|
||||||
def changeToPlaylistIndexFromFilename(self, filename):
|
def changeToPlaylistIndexFromFilename(self, filename):
|
||||||
try:
|
try:
|
||||||
@ -1637,15 +1602,6 @@ class SyncplayPlaylist():
|
|||||||
self.changePlaylist(shuffledPlaylist, username=None, resetIndex=True)
|
self.changePlaylist(shuffledPlaylist, username=None, resetIndex=True)
|
||||||
self.switchToNewPlaylistIndex(0, resetPosition=True)
|
self.switchToNewPlaylistIndex(0, resetPosition=True)
|
||||||
|
|
||||||
@needsSharedPlaylistsEnabled
|
|
||||||
def addFileToPlaylist(self, filename):
|
|
||||||
if filename in self._playlist:
|
|
||||||
return
|
|
||||||
newPlaylist = deepcopy(self._playlist)
|
|
||||||
newPlaylist.append(filename)
|
|
||||||
if newPlaylist <> self._playlist:
|
|
||||||
self.changePlaylist(newPlaylist, username=None, resetIndex=False)
|
|
||||||
|
|
||||||
def canUndoPlaylist(self, currentPlaylist):
|
def canUndoPlaylist(self, currentPlaylist):
|
||||||
return self._previousPlaylist is not None and currentPlaylist <> self._previousPlaylist
|
return self._previousPlaylist is not None and currentPlaylist <> self._previousPlaylist
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,6 @@ class ConfigurationGetter(object):
|
|||||||
"showNonControllerOSD" : False,
|
"showNonControllerOSD" : False,
|
||||||
"showContactInfo" : True,
|
"showContactInfo" : True,
|
||||||
"showDurationNotification" : True,
|
"showDurationNotification" : True,
|
||||||
"dropFileAddsToPlaylist": False,
|
|
||||||
"publicServers" : []
|
"publicServers" : []
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +106,6 @@ class ConfigurationGetter(object):
|
|||||||
"sharedPlaylistEnabled",
|
"sharedPlaylistEnabled",
|
||||||
"loopAtEndOfPlaylist",
|
"loopAtEndOfPlaylist",
|
||||||
"loopSingleFiles",
|
"loopSingleFiles",
|
||||||
"dropFileAddsToPlaylist",
|
|
||||||
"onlySwitchToTrustedDomains"
|
"onlySwitchToTrustedDomains"
|
||||||
]
|
]
|
||||||
self._tristate = [
|
self._tristate = [
|
||||||
@ -142,7 +140,6 @@ class ConfigurationGetter(object):
|
|||||||
"autoplayInitialState", "mediaSearchDirectories",
|
"autoplayInitialState", "mediaSearchDirectories",
|
||||||
"sharedPlaylistEnabled", "loopAtEndOfPlaylist",
|
"sharedPlaylistEnabled", "loopAtEndOfPlaylist",
|
||||||
"loopSingleFiles",
|
"loopSingleFiles",
|
||||||
"dropFileAddsToPlaylist",
|
|
||||||
"onlySwitchToTrustedDomains", "trustedDomains","publicServers"],
|
"onlySwitchToTrustedDomains", "trustedDomains","publicServers"],
|
||||||
"gui": ["showOSD", "showOSDWarnings", "showSlowdownOSD",
|
"gui": ["showOSD", "showOSDWarnings", "showSlowdownOSD",
|
||||||
"showDifferentRoomOSD", "showSameRoomOSD",
|
"showDifferentRoomOSD", "showSameRoomOSD",
|
||||||
|
|||||||
@ -612,7 +612,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
if roomToJoin <> self._syncplayClient.getRoom():
|
if roomToJoin <> self._syncplayClient.getRoom():
|
||||||
menu.addAction(getMessage("joinroom-menu-label").format(roomToJoin), lambda: self.joinRoom(roomToJoin))
|
menu.addAction(getMessage("joinroom-menu-label").format(roomToJoin), lambda: self.joinRoom(roomToJoin))
|
||||||
elif username and filename and filename <> getMessage("nofile-note"):
|
elif username and filename and filename <> getMessage("nofile-note"):
|
||||||
if self._syncplayClient.sharedPlaylistIsEnabled() and not self.isItemInPlaylist(filename):
|
if self.config['sharedPlaylistEnabled'] and not self.isItemInPlaylist(filename):
|
||||||
if isURL(filename):
|
if isURL(filename):
|
||||||
menu.addAction(QtGui.QPixmap(resourcespath + u"world_add.png"),getMessage("addusersstreamstoplaylist-menu-label").format(shortUsername), lambda: self.addStreamToPlaylist(filename))
|
menu.addAction(QtGui.QPixmap(resourcespath + u"world_add.png"),getMessage("addusersstreamstoplaylist-menu-label").format(shortUsername), lambda: self.addStreamToPlaylist(filename))
|
||||||
else:
|
else:
|
||||||
@ -681,11 +681,11 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
if self._isTryingToChangeToCurrentFile(filename):
|
if self._isTryingToChangeToCurrentFile(filename):
|
||||||
return
|
return
|
||||||
if isURL(filename):
|
if isURL(filename):
|
||||||
self._syncplayClient.openFile(filename, resetPosition=True)
|
self._syncplayClient._player.openFile(filename, resetPosition=True)
|
||||||
else:
|
else:
|
||||||
pathFound = self._syncplayClient.fileSwitch.findFilepath(filename, highPriority=True)
|
pathFound = self._syncplayClient.fileSwitch.findFilepath(filename, highPriority=True)
|
||||||
if pathFound:
|
if pathFound:
|
||||||
self._syncplayClient.openFile(pathFound, resetPosition=True)
|
self._syncplayClient._player.openFile(pathFound, resetPosition=True)
|
||||||
else:
|
else:
|
||||||
self._syncplayClient.ui.showErrorMessage(getMessage("cannot-find-file-for-playlist-switch-error").format(filename))
|
self._syncplayClient.ui.showErrorMessage(getMessage("cannot-find-file-for-playlist-switch-error").format(filename))
|
||||||
|
|
||||||
@ -708,11 +708,11 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
if self._isTryingToChangeToCurrentFile(filename):
|
if self._isTryingToChangeToCurrentFile(filename):
|
||||||
return
|
return
|
||||||
if isURL(filename):
|
if isURL(filename):
|
||||||
self._syncplayClient.openFile(filename)
|
self._syncplayClient._player.openFile(filename)
|
||||||
else:
|
else:
|
||||||
pathFound = self._syncplayClient.fileSwitch.findFilepath(filename, highPriority=True)
|
pathFound = self._syncplayClient.fileSwitch.findFilepath(filename, highPriority=True)
|
||||||
if pathFound:
|
if pathFound:
|
||||||
self._syncplayClient.openFile(pathFound)
|
self._syncplayClient._player.openFile(pathFound)
|
||||||
else:
|
else:
|
||||||
self._syncplayClient.fileSwitch.updateInfo()
|
self._syncplayClient.fileSwitch.updateInfo()
|
||||||
self.showErrorMessage(getMessage("switch-file-not-found-error").format(filename))
|
self.showErrorMessage(getMessage("switch-file-not-found-error").format(filename))
|
||||||
@ -869,7 +869,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.mediadirectory = os.path.dirname(fileName)
|
self.mediadirectory = os.path.dirname(fileName)
|
||||||
self._syncplayClient.fileSwitch.setCurrentDirectory(self.mediadirectory)
|
self._syncplayClient.fileSwitch.setCurrentDirectory(self.mediadirectory)
|
||||||
self.saveMediaBrowseSettings()
|
self.saveMediaBrowseSettings()
|
||||||
self._syncplayClient.openFile(fileName)
|
self._syncplayClient._player.openFile(fileName)
|
||||||
|
|
||||||
@needsClient
|
@needsClient
|
||||||
def OpenAddFilesToPlaylistDialog(self):
|
def OpenAddFilesToPlaylistDialog(self):
|
||||||
@ -1051,7 +1051,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
getMessage("promptforstreamurlinfo-msgbox-label"), QtWidgets.QLineEdit.Normal,
|
getMessage("promptforstreamurlinfo-msgbox-label"), QtWidgets.QLineEdit.Normal,
|
||||||
"")
|
"")
|
||||||
if ok and streamURL != '':
|
if ok and streamURL != '':
|
||||||
self._syncplayClient.openFile(streamURL)
|
self._syncplayClient._player.openFile(streamURL)
|
||||||
|
|
||||||
@needsClient
|
@needsClient
|
||||||
def createControlledRoom(self):
|
def createControlledRoom(self):
|
||||||
@ -1575,18 +1575,10 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
data = event.mimeData()
|
data = event.mimeData()
|
||||||
urls = data.urls()
|
urls = data.urls()
|
||||||
if urls and urls[0].scheme() == 'file':
|
if urls and urls[0].scheme() == 'file':
|
||||||
url = event.mimeData().urls()[0]
|
|
||||||
if isMacOS() and IsPySide:
|
if isMacOS() and IsPySide:
|
||||||
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
|
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
|
||||||
else:
|
else:
|
||||||
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
|
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
|
||||||
if self.config['dropFileAddsToPlaylist'] and self._syncplayClient.sharedPlaylistIsEnabled():
|
|
||||||
filename = dropfilepath if isURL(dropfilepath) else os.path.basename(dropfilepath)
|
|
||||||
if self.isItemInPlaylist(filename):
|
|
||||||
self._syncplayClient._player.openFile(dropfilepath)
|
|
||||||
else:
|
|
||||||
self.addFileToPlaylist(dropfilepath)
|
|
||||||
return
|
|
||||||
if rewindFile == False:
|
if rewindFile == False:
|
||||||
self._syncplayClient._player.openFile(dropfilepath)
|
self._syncplayClient._player.openFile(dropfilepath)
|
||||||
else:
|
else:
|
||||||
@ -1634,7 +1626,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.playlist.insertItem(index, filePath)
|
self.playlist.insertItem(index, filePath)
|
||||||
|
|
||||||
def openFile(self, filePath, resetPosition=False):
|
def openFile(self, filePath, resetPosition=False):
|
||||||
self._syncplayClient.openFile(filePath, resetPosition)
|
self._syncplayClient._player.openFile(filePath, resetPosition)
|
||||||
|
|
||||||
def noPlaylistDuplicates(self, filename):
|
def noPlaylistDuplicates(self, filename):
|
||||||
if self.isItemInPlaylist(filename):
|
if self.isItemInPlaylist(filename):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user