Remove dropFileAddsToPlaylist for now

This commit is contained in:
Etoh 2017-12-25 13:22:10 +00:00
parent e6238a54ee
commit ec3bb067f3
3 changed files with 10 additions and 65 deletions

View File

@ -117,9 +117,6 @@ class SyncplayClient(object):
self.autoPlay = False
self.autoPlayThreshold = None
self.ignorePath = None
self.ignorePathTime = None
self.autoplayTimer = task.LoopingCall(self.autoplayCountdown)
self.autoplayTimeLeft = constants.AUTOPLAY_DELAY
@ -448,11 +445,6 @@ class SyncplayClient(object):
return self._globalPaused
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""
if utils.isURL(path):
try:
@ -469,28 +461,6 @@ class SyncplayClient(object):
size = os.path.getsize(path)
except:
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):
self.fileSwitch.notifyUserIfFileNotInMediaDirectory(filename, path)
filename, size = self.__executePrivacySettings(filename, size)
@ -532,7 +502,7 @@ class SyncplayClient(object):
return False
def openFile(self, filePath, resetPosition=False):
self.playlist.openedFile(filePath)
self.playlist.openedFile()
self._player.openFile(filePath, resetPosition)
if resetPosition:
self.establishRewindDoubleCheck()
@ -1454,7 +1424,6 @@ class SyncplayPlaylist():
self._playlistIndex = None
self.addedChangeListCallback = False
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
@wraps(f)
@ -1465,12 +1434,8 @@ class SyncplayPlaylist():
return f(self, *args, **kwds)
return wrapper
def openedFile(self, filePath):
def openedFile(self):
self._lastPlaylistIndexChange = time.time()
if utils.isURL(filePath):
self.lastFileOpened = None
return
self.lastFileOpened = os.path.basename(filePath)
def changeToPlaylistIndexFromFilename(self, filename):
try:
@ -1637,15 +1602,6 @@ class SyncplayPlaylist():
self.changePlaylist(shuffledPlaylist, username=None, resetIndex=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):
return self._previousPlaylist is not None and currentPlaylist <> self._previousPlaylist

View File

@ -64,7 +64,6 @@ class ConfigurationGetter(object):
"showNonControllerOSD" : False,
"showContactInfo" : True,
"showDurationNotification" : True,
"dropFileAddsToPlaylist": False,
"publicServers" : []
}
@ -107,7 +106,6 @@ class ConfigurationGetter(object):
"sharedPlaylistEnabled",
"loopAtEndOfPlaylist",
"loopSingleFiles",
"dropFileAddsToPlaylist",
"onlySwitchToTrustedDomains"
]
self._tristate = [
@ -142,7 +140,6 @@ class ConfigurationGetter(object):
"autoplayInitialState", "mediaSearchDirectories",
"sharedPlaylistEnabled", "loopAtEndOfPlaylist",
"loopSingleFiles",
"dropFileAddsToPlaylist",
"onlySwitchToTrustedDomains", "trustedDomains","publicServers"],
"gui": ["showOSD", "showOSDWarnings", "showSlowdownOSD",
"showDifferentRoomOSD", "showSameRoomOSD",

View File

@ -612,7 +612,7 @@ class MainWindow(QtWidgets.QMainWindow):
if roomToJoin <> self._syncplayClient.getRoom():
menu.addAction(getMessage("joinroom-menu-label").format(roomToJoin), lambda: self.joinRoom(roomToJoin))
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):
menu.addAction(QtGui.QPixmap(resourcespath + u"world_add.png"),getMessage("addusersstreamstoplaylist-menu-label").format(shortUsername), lambda: self.addStreamToPlaylist(filename))
else:
@ -681,11 +681,11 @@ class MainWindow(QtWidgets.QMainWindow):
if self._isTryingToChangeToCurrentFile(filename):
return
if isURL(filename):
self._syncplayClient.openFile(filename, resetPosition=True)
self._syncplayClient._player.openFile(filename, resetPosition=True)
else:
pathFound = self._syncplayClient.fileSwitch.findFilepath(filename, highPriority=True)
if pathFound:
self._syncplayClient.openFile(pathFound, resetPosition=True)
self._syncplayClient._player.openFile(pathFound, resetPosition=True)
else:
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):
return
if isURL(filename):
self._syncplayClient.openFile(filename)
self._syncplayClient._player.openFile(filename)
else:
pathFound = self._syncplayClient.fileSwitch.findFilepath(filename, highPriority=True)
if pathFound:
self._syncplayClient.openFile(pathFound)
self._syncplayClient._player.openFile(pathFound)
else:
self._syncplayClient.fileSwitch.updateInfo()
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._syncplayClient.fileSwitch.setCurrentDirectory(self.mediadirectory)
self.saveMediaBrowseSettings()
self._syncplayClient.openFile(fileName)
self._syncplayClient._player.openFile(fileName)
@needsClient
def OpenAddFilesToPlaylistDialog(self):
@ -1051,7 +1051,7 @@ class MainWindow(QtWidgets.QMainWindow):
getMessage("promptforstreamurlinfo-msgbox-label"), QtWidgets.QLineEdit.Normal,
"")
if ok and streamURL != '':
self._syncplayClient.openFile(streamURL)
self._syncplayClient._player.openFile(streamURL)
@needsClient
def createControlledRoom(self):
@ -1575,18 +1575,10 @@ class MainWindow(QtWidgets.QMainWindow):
data = event.mimeData()
urls = data.urls()
if urls and urls[0].scheme() == 'file':
url = event.mimeData().urls()[0]
if isMacOS() and IsPySide:
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
else:
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:
self._syncplayClient._player.openFile(dropfilepath)
else:
@ -1634,7 +1626,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.playlist.insertItem(index, filePath)
def openFile(self, filePath, resetPosition=False):
self._syncplayClient.openFile(filePath, resetPosition)
self._syncplayClient._player.openFile(filePath, resetPosition)
def noPlaylistDuplicates(self, filename):
if self.isItemInPlaylist(filename):