mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Add:Sort by duration for audiobooks and sort by number of episodes for podcasts #558
This commit is contained in:
		
							parent
							
								
									db48a486e5
								
							
						
					
					
						commit
						55c40658f2
					
				@ -256,8 +256,9 @@ export default {
 | 
				
			|||||||
      if (this.orderBy === 'mtimeMs') return 'Modified ' + this.$formatDate(this._libraryItem.mtimeMs)
 | 
					      if (this.orderBy === 'mtimeMs') return 'Modified ' + this.$formatDate(this._libraryItem.mtimeMs)
 | 
				
			||||||
      if (this.orderBy === 'birthtimeMs') return 'Born ' + this.$formatDate(this._libraryItem.birthtimeMs)
 | 
					      if (this.orderBy === 'birthtimeMs') return 'Born ' + this.$formatDate(this._libraryItem.birthtimeMs)
 | 
				
			||||||
      if (this.orderBy === 'addedAt') return 'Added ' + this.$formatDate(this._libraryItem.addedAt)
 | 
					      if (this.orderBy === 'addedAt') return 'Added ' + this.$formatDate(this._libraryItem.addedAt)
 | 
				
			||||||
      if (this.orderBy === 'duration') return 'Duration: ' + this.$elapsedPrettyExtended(this.media.duration, false)
 | 
					      if (this.orderBy === 'media.duration') return 'Duration: ' + this.$elapsedPrettyExtended(this.media.duration, false)
 | 
				
			||||||
      if (this.orderBy === 'size') return 'Size: ' + this.$bytesPretty(this._libraryItem.size)
 | 
					      if (this.orderBy === 'size') return 'Size: ' + this.$bytesPretty(this._libraryItem.size)
 | 
				
			||||||
 | 
					      if (this.orderBy === 'media.numTracks') return `${this.numEpisodes} Episodes`
 | 
				
			||||||
      return null
 | 
					      return null
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    episodeProgress() {
 | 
					    episodeProgress() {
 | 
				
			||||||
 | 
				
			|||||||
@ -52,6 +52,10 @@ export default {
 | 
				
			|||||||
          text: 'Size',
 | 
					          text: 'Size',
 | 
				
			||||||
          value: 'size'
 | 
					          value: 'size'
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          text: 'Duration',
 | 
				
			||||||
 | 
					          value: 'media.duration'
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          text: 'File Birthtime',
 | 
					          text: 'File Birthtime',
 | 
				
			||||||
          value: 'birthtimeMs'
 | 
					          value: 'birthtimeMs'
 | 
				
			||||||
@ -78,6 +82,10 @@ export default {
 | 
				
			|||||||
          text: 'Size',
 | 
					          text: 'Size',
 | 
				
			||||||
          value: 'size'
 | 
					          value: 'size'
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          text: '# of Episodes',
 | 
				
			||||||
 | 
					          value: 'media.numTracks'
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          text: 'File Birthtime',
 | 
					          text: 'File Birthtime',
 | 
				
			||||||
          value: 'birthtimeMs'
 | 
					          value: 'birthtimeMs'
 | 
				
			||||||
 | 
				
			|||||||
@ -72,6 +72,9 @@ export const actions = {
 | 
				
			|||||||
      if (state.settings.orderBy == 'media.metadata.authorName' || state.settings.orderBy == 'media.metadata.authorNameLF') {
 | 
					      if (state.settings.orderBy == 'media.metadata.authorName' || state.settings.orderBy == 'media.metadata.authorNameLF') {
 | 
				
			||||||
        settingsUpdate.orderBy = 'media.metadata.author'
 | 
					        settingsUpdate.orderBy = 'media.metadata.author'
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      if (state.settings.orderBy == 'media.duration') {
 | 
				
			||||||
 | 
					        settingsUpdate.orderBy = 'media.numTracks'
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      var invalidFilters = ['series', 'authors', 'narrators', 'languages', 'progress', 'issues']
 | 
					      var invalidFilters = ['series', 'authors', 'narrators', 'languages', 'progress', 'issues']
 | 
				
			||||||
      var filterByFirstPart = (state.settings.filterBy || '').split('.').shift()
 | 
					      var filterByFirstPart = (state.settings.filterBy || '').split('.').shift()
 | 
				
			||||||
      if (invalidFilters.includes(filterByFirstPart)) {
 | 
					      if (invalidFilters.includes(filterByFirstPart)) {
 | 
				
			||||||
@ -81,6 +84,9 @@ export const actions = {
 | 
				
			|||||||
      if (state.settings.orderBy == 'media.metadata.author') {
 | 
					      if (state.settings.orderBy == 'media.metadata.author') {
 | 
				
			||||||
        settingsUpdate.orderBy = 'media.metadata.authorName'
 | 
					        settingsUpdate.orderBy = 'media.metadata.authorName'
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      if (state.settings.orderBy == 'media.numTracks') {
 | 
				
			||||||
 | 
					        settingsUpdate.orderBy = 'media.duration'
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (Object.keys(settingsUpdate).length) {
 | 
					    if (Object.keys(settingsUpdate).length) {
 | 
				
			||||||
      dispatch('updateUserSettings', settingsUpdate)
 | 
					      dispatch('updateUserSettings', settingsUpdate)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user