#!/usr/bin/env python3 import sys import re file = sys.argv f = open(file, 'rb') seek_positoin = 0 artist_string = b'artist=' line = b'' f.seek(seek_positoin) while artist_string.upper() or artist_string.lower() not in line: line = f.readline() if artist_string.upper() or artist_string.lower() in line: seek_positoin = line.find(artist_string) f.seek(seek_positoin, 1) word = f.read(10) #line = str(line) #position = line.find('Artist') #print(position) print(line) print(word) f.close()
In the above program I'm running it with the command line argument River_Of_Deceit.flac, which I got from http://melodishop.com/
When I look through the meta data I see that the artist is preceded by 'ARTIST='. If I run the program with artist_string.upper() or hard code artist_string = 'ARTIST=' it works, but the second I put in 'or' artist_sting.loser() and, 'or' artist_string.title() the program stops giving me any output at all. I need to be able to catch upper, lower, and titled tags because I have found .flac files with upper case and Titled case both so far, so need to be able to cover multiple possiblilties. I would thing they would all have to be the same but go figure. Also, after removing the 'or's the program gives me the line containing artist but the variable word always gives me garbage, do you see anything wrong with how I'm coming up with word? It should print 'arist=' pluse 3 characters of the actual title.