Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (0)

Powered by Vanilla. Made with Bootstrap.
positioning pointer file
  • schumbag
    Posts: 23
    This example illustrates the program to read from a file format id3 mp3.
    for ID3v1, will be stored at 128 the last byte, where if the file has a tag (id3), then TAG.for there will be writing the file to have this tag, we will process it, it's just should be in a position to move the file pointer to the last 128 bytes.

    #!/usr/bin/python
    #coder : cakill schumbag
    #program ilustrasikan mp3 reader
    #untuk file yang memiliki TAG akan di proses
    #tapi sebelumnya harus di pindah ke posisi pointer 128 byte terakhir
    import sys
    def main():
    if len(sys.argv) < 2 :
    sys.exit('gk terjadi apa-apa tuh')
    else:
    try:
    a = open(sys.argv[1])
    a.seek(-128,2)
    info = ()
    if a.read(3) == 'TAG':
    info['title'] = a.read(30) .strip()
    info['artist'] = a.read(30) .strip()
    info['album'] = a.read(30) .strip()
    info['year'] = a.read(4) .strip()
    info['comment'] = a.read(30) .strip()
    a.close()
    for i in info.keys():
    print'%s = %s' %(i,info[i])
    else:
    a.close()
    sys.exit('file nya gak pake tag')

    except IOError, msg:
    sys.exit(msg)
    if __name__ == '__main__':
    main()


    Explanation :

    a = open(sys.argv[1])
    a.seek(-128,2)
    info = ()
    if a.read(3) == 'TAG':
    info['title'] = a.read(30) .strip()
    info['artist'] = a.read(30) .strip()
    info['album'] = a.read(30) .strip()
    info['year'] = a.read(4) .strip()
    info['comment'] = a.read(30) .strip()

    after we move the file pointer position and know that the file
    have a tag, we can get the title, artist, album, year and comment reply one by one have a data width 30byte, 30byte, 30byte, 4byte, and 30byte sequentially relative to one another.
    This script put it all into one dir.
    http://lppt.ugm.ac.id/py.png

    and this. . .

    for i in info.keys():
    print'%s = %s' %(i,info[i])

    will print the info that we can

    regards,and say hi from indonesian :)
  • D0WNGRADE
    Posts: 220
    Very nice, I love A7X also! xD
  • Xin
    Posts: 3,251
    Very nice, whats this wisdom-botnet in the BG ? :P Not sure i would code a bot in python it being interpreted and all. The outputs from py2exe are very big in size as well.
    Xin
  • schumbag
    Posts: 23
    wisdom-botnet.pl are the worm created my friends he are the darkjumper's creator from indonesian too :)