Skip to content

Add option to display abook length #1

@aylen384

Description

@aylen384

Maybe cache the info within the abook folder?

Sample code for mp3:

#!/usr/bin/python                                                                                                                                              

import glob
from mutagen.mp3 import MP3 
files = glob.glob ('*.mp3')
myTotal = 0 
 
def fix_time( seconds ):
  hours = int(seconds) / 3600
  seconds = seconds % 3600
  minutes = int(seconds) / 60
  seconds = seconds % 60
  seconds = int(seconds)
  return "%d:%02d:%02d" % (hours, minutes, seconds)
 
for eachfile in files:
    audio = MP3(eachfile)
    eachTime = fix_time( audio.info.length )
    print("File: %s - Length: %s" % (eachfile, eachTime))
    myTotal = myTotal + audio.info.length
 
newTotal = fix_time( myTotal )   
print("Total time: %s" % (newTotal))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions