Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1

    [VB6] Proprietà dei file...

    Ciao a tutti. ho questo problema:
    vorrei riuscire ad estrarre tutte le informazioni da un tipo di file...
    Allora... mi spiego meglio:
    facciamo il caso che voglio sapere tutto su un file .mp3. L'autorem, la durata... insomma tutte cose che normalemnte un lettore mp3 riesce a catturare direttamente dal file.
    Io voglio catturare queste informazioni e memorizzarle su un db. Riesco a fare tutto ma non riesco a catturare quelle informazioni come l'autore o la durata o se si tratta di un video la risoluzione etc etc.... non so che fare.... per adesso sono solo riuscito a tirare fuori info come (archivio) (read-only) ma nessuna traccia di tutto il resto...
    Porto un altro esempio. Se scrivete un file con word... e andate a vedere successivamente le proprietà di quel file... vi accorgerete che alla voce AUTORE, comparirà il nome con il quale è stato registrato Word... o cmq il nome della società.
    Come si estrapola fuori questa informazione !?
    grazie a tutti
    Drummino
    -------------------------
    ..::`DrUmM\n0`::..
    www.jonathandomenici.com

  2. #2
    dunque...cercando sulla rete ho trovato che la finestra proprietà viene chiamata da un'API. L'aPI è ShellExecuteEx. All'interno di questa API viene chiamata SHELLEXECUTEINFO, dove (a quanto ho capito) sono raccolte tutte le informazioni di cui parlavo prima. rimane un solo problema. ome estrarle una ad una !?


    plz help!

    Grazie
    Drummino
    -------------------------
    ..::`DrUmM\n0`::..
    www.jonathandomenici.com

  3. #3
    nessuno sa darmi una mano !?
    :master:
    -------------------------
    ..::`DrUmM\n0`::..
    www.jonathandomenici.com

  4. #4
    se volete posso passare il codice....
    qualche indizio !?
    grazie
    -------------------------
    ..::`DrUmM\n0`::..
    www.jonathandomenici.com

  5. #5

    ...

    non ricordo bene la API, ma dovrebbe contenere una struttura di FILEINFO...non ricordo nemmeno bene il nome!!
    una l'Api viewer....
    appena arrivi ad una struttura con *FILEINFO*.....la struttura dovrebbe contenere tutti i dati ke hai bisogno.....
    .......
    quando torno a casa e avvio VB, approfondisco...e ti faccio sapere.....
    .......
    .......
    per ora....
    by giuSp [.NetDeveloper]

    ___________
    un po' di VB non fa male!....?
    C# more power to you!!

  6. #6
    grazie mille!!!!!!
    ci conto che sto impazzendo1!! :bubu:
    -------------------------
    ..::`DrUmM\n0`::..
    www.jonathandomenici.com

  7. #7
    Utente di HTML.it
    Registrato dal
    Jun 2001
    Messaggi
    61
    Originariamente inviato da drummino^
    grazie mille!!!!!!
    ci conto che sto impazzendo1!! :bubu:
    a me interesserebbe il proseguio di questa storia, che dite ho qualche speranza?

  8. #8
    in um mod di classe clsmp3.cls

    codice:
    Private mvarFilename As String
    Private Type Info
        sTitle As String
        sArtist As String
        sAlbum As String
        sComment As String
        sYear As String
        sGenre As String
    End Type
    Private MP3Info As Info
    Public Property Get Filename() As String
        Filename = mvarFilename
    End Property
    
    Private Function IsValidFile(ByVal sFilename) As Boolean
        Dim bOk As Boolean
        ' make sure file exists
        bOk = CBool(Dir(sFilename, vbHidden) <> "")
        Dim aExtensions, ext
        aExtensions = Array(".mp3", ".mp2", ".mp1")
        Dim bOkayExtension As Boolean
        bOkayExtension = False
        If bOk Then
            For Each ext In aExtensions
                If InStr(1, sFilename, ext, vbTextCompare) > 0 Then
                    bOkayExtension = True
                End If
            Next    'ext
        End If
        IsValidFile = bOk And bOkayExtension
    End Function
    
    Public Property Let Filename(ByVal sPassFilename As String)
        Dim iFreefile As Integer
        Dim lFilePos As Long
        Dim sData As String * 128
        Dim sGenre() As String
        ' Genre
        Const sGenreMatrix As String = "Blues|Classic Rock|Country|Dance|Disco|Funk|Grunge|" + _
            "Hip-Hop|Jazz|Metal|New Age|Oldies|Other|Pop|R&B|Rap|Reggae|Rock|Techno|" + _
            "Industrial|Alternative|Ska|Death Metal|Pranks|Soundtrack|Euro-Techno|" + _
            "Ambient|Trip Hop|Vocal|Jazz+Funk|Fusion|Trance|Classical|Instrumental|Acid|" + _
            "House|Game|Sound Clip|Gospel|Noise|Alt. Rock|Bass|Soul|Punk|Space|Meditative|" + _
            "Instrumental Pop|Instrumental Rock|Ethnic|Gothic|Darkwave|Techno-Industrial|Electronic|" + _
            "Pop-Folk|Eurodance|Dream|Southern Rock|Comedy|Cult|Gangsta Rap|Top 40|Christian Rap|" + _
            "Pop/Punk|Jungle|Native American|Cabaret|New Wave|Phychedelic|Rave|Showtunes|Trailer|" + _
            "Lo-Fi|Tribal|Acid Punk|Acid Jazz|Polka|Retro|Musical|Rock & Roll|Hard Rock|Folk|" + _
            "Folk/Rock|National Folk|Swing|Fast-Fusion|Bebob|Latin|Revival|Celtic|Blue Grass|" + _
            "Avantegarde|Gothic Rock|Progressive Rock|Psychedelic Rock|Symphonic Rock|Slow Rock|" + _
            "Big Band|Chorus|Easy Listening|Acoustic|Humour|Speech|Chanson|Opera|Chamber Music|" + _
            "Sonata|Symphony|Booty Bass|Primus|Porn Groove|Satire|Slow Jam|Club|Tango|Samba|Folklore|" + _
            "Ballad|power Ballad|Rhythmic Soul|Freestyle|Duet|Punk Rock|Drum Solo|A Capella|Euro-House|" + _
            "Dance Hall|Goa|Drum & Bass|Club-House|Hardcore|Terror|indie|Brit Pop|Negerpunk|Polsk Punk|" + _
            "Beat|Christian Gangsta Rap|Heavy Metal|Black Metal|Crossover|Comteporary Christian|" + _
            "Christian Rock|Merengue|Salsa|Trash Metal|Anime|JPop|Synth Pop"
        ' Build the Genre array (VB6+ only)
        sGenre = Split(sGenreMatrix, "|")
        ' Store the filename (for "Get Filename"
        '     property)
        mvarFilename = sPassFilename
        ' Clear the info variables
        If Not IsValidFile(sPassFilename) Then    ' bug fix
        Exit Property
    End If
    MP3Info.sTitle = ""
    MP3Info.sArtist = ""
    MP3Info.sAlbum = ""
    MP3Info.sYear = ""
    MP3Info.sComment = ""
    ' Ensure the MP3 file exists
    ' Retrieve the info data from the MP3
    iFreefile = FreeFile
    lFilePos = FileLen(mvarFilename) - 127
    If lFilePos > 0 Then    ' bug fix
    Open mvarFilename For Binary As #iFreefile
    Get #iFreefile, lFilePos, sData
    Close #iFreefile
    End If
    ' Populate the info variables
    If Left(sData, 3) = "TAG" Then
    MP3Info.sTitle = Mid(sData, 4, 30)
    MP3Info.sArtist = Mid(sData, 34, 30)
    MP3Info.sAlbum = Mid(sData, 64, 30)
    MP3Info.sYear = Mid(sData, 94, 4)
    MP3Info.sComment = Mid(sData, 98, 30)
    Dim lGenre
    lGenre = Asc(Mid(sData, 128, 1))
    If lGenre <= UBound(sGenre) Then
        MP3Info.sGenre = sGenre(lGenre)
    Else
        MP3Info.sGenre = ""
    End If
    Else
    MP3Info = GetInfo(mvarFilename)
    End If
    End Property
    
    Private Function GetInfo(ByVal sFilename) As Info
    Dim i As Info
    GetInfo = i
    Dim s
    s = sFilename
    If InStrRev(s, "\) > 0 Then    'it's a full path
    s = Mid(s, InStrRev(s, "\) + 1)
    End If
    'drop extension
    s = Left(s, InStrRev(s, ".", , vbTextCompare) - 1)
    s = Replace(Trim(s), " ", " ")
    s = Trim(s)
    If CountItems(s, " ") < 1 Then
    i.sTitle = Replace(s, "_", " ")
    GetInfo = i
    Exit Function
    End If
    s = Trim(Replace(s, "_", " "))
    If Left(s, 1) = "(" And CountItems(s, "-") < 3 Then
    i.sArtist = Mid(s, 2, InStr(s, ")") - 2)
    s = Trim(Mid(s, InStr(s, ")") + 1))
    If Left(s, 1) = "-" Then    'grab title
    i.sTitle = Trim(Mid(s, 2))
    Else    'grab title anyway
    If InStr(s, "-") > 0 Then
    i.sAlbum = Mid(s, InStr(s, "-") + 1)
    i.sTitle = Left(s, InStr(s, "-") - 1)
    Else
    i.sTitle = Trim(s)
    End If
    End If
    Else
    Dim aThings
    Dim l
    aThings = Split(s, "- ")
    For l = 0 To UBound(aThings)
    If Not IsNumeric(aThings(l)) Then
    If i.sArtist = "" Then
        i.sArtist = aThings(l)
    Else
        If IsNumeric(aThings(l - 1)) Then    ' title
        If i.sTitle = "" Then
            i.sTitle = aThings(l)
        End If
    ElseIf i.sAlbum = "" Then
        i.sAlbum = aThings(l)
    End If
    End If
    End If
    Next    ' i
    End If
    i.sArtist = Replace(Replace(i.sArtist, "(", ""), ")", "")
    If Left(s, 1) <> "(" And i.sTitle = "" And (InStr(sFilename, "\) <> InStrRev(sFilename, "\)) Then
    ' recurse
    GetInfo = GetInfo(FixDir(sFilename))
    Else
    GetInfo = i
    End If
    End Function
    
    Private Function CountItems(s, sToCount)
    Dim a
    a = Split(s, sToCount)
    If UBound(a) = -1 Then
    CountItems = 0
    Else
    CountItems = UBound(a) - LBound(a)
    End If
    End Function
    
    Private Function FixDir(sFullpath)
    Dim s1, s2
    s1 = Trim(Left(sFullpath, InStrRev(sFullpath, "\) - 1))
    s2 = Trim(Mid(sFullpath, InStrRev(sFullpath, "\) + 1))
    FixDir = s1 & " - " & s2
    End Function
    
    Public Property Get Title() As String
    Title = Trim(MP3Info.sTitle)
    End Property
    
    Public Property Get Artist() As String
    Artist = Trim(MP3Info.sArtist)
    End Property
    
    Public Property Get Genre() As String
    Genre = Trim(MP3Info.sGenre)
    End Property
    
    Public Property Get Album() As String
    Album = Trim(MP3Info.sAlbum)
    End Property
    
    Public Property Get Year() As String
    Year = Trim(MP3Info.sYear)
    End Property
    
    Public Property Get Comment() As String
    Comment = Trim(MP3Info.sComment)
    End Property
    in un form con una listbox list1 e una common dialog cd1

    codice:
    Option Explicit
    Dim mp3 As clsmp3
    Private Sub Form_Load()
    Set mp3 = New clsmp3
    cd1.Filter = "File mp3|*.mp3|(*.mp3)"
    cd1.ShowOpen
    mp3.Filename = cd1.Filename
    List1.AddItem mp3.Title
    List1.AddItem mp3.Artist
    List1.AddItem mp3.Album
    List1.AddItem mp3.Year
    List1.AddItem mp3.Genre
    List1.AddItem mp3.Comment
    List1.AddItem mp3.Filename
    End Sub
    Vascello fantasma dei mentecatti nonchè baronetto della scara corona alcolica, piccolo spuccello di pezza dislessico e ubriaco- Colui che ha modificato l'orribile scritta - Gran Evacuatore Mentecatto - Tristo Mietitore Mentecatto chi usa uTonter danneggia anche te

  9. #9
    Utente di HTML.it
    Registrato dal
    Feb 2003
    Messaggi
    4
    ....ciao avevo anche io il problema di sapere la durata di un mp3....ho visto il codice ma le info che da sono solo il genere l'album l'artista ecc....non la durata....mi sbaglio?.....
    Mylo---------------------->

  10. #10
    mi pare che per calcolare la durata entrino in gioco il bitrate dell'mp3 e la lunghezza del file... prova a cercare in qualche altro 3D sul forum... c'era da qualche parte una domanda sui tag degli mp3... ora non ricordo dove. scusa lo farei io ma non ho molto tempo... Ciao!!!

    ti ricordi quando da piccoli andavamo in treno? io mettevo il culo fuori dal finestrino e tu la faccia e tutti ci chiedevano se eravamo gemelli...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.