Class: Catori::XML
- Inherits:
-
Object
- Object
- Catori::XML
- Defined in:
- lib/catori/XML.rb
Instance Method Summary collapse
- #actualizar ⇒ Object
-
#initialize(sFile) ⇒ XML
constructor
A new instance of XML.
- #rastrea ⇒ Object
Constructor Details
Instance Method Details
#actualizar ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/catori/XML.rb', line 24 def actualizar albums=[] i=0 @archivos.each{|oInfo| Catori::Db.llenarArtista(oInfo) Catori::Db.llenarAlbum(oInfo) Catori::Db.llenarCancion(oInfo) id_album=oInfo.album.crearSha+oInfo.artist.crearSha if !oInfo.year.nil? and !albums.include?(id_album) Catori::Db.actualizarAlbumFecha(oInfo) albums.push(id_album) end Catori::Db.actualizarArchivo(oInfo) i+=1 } i end |
#rastrea ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/catori/XML.rb', line 11 def rastrea @root.elements.each("file") {|f| cd=f.attributes['cd'] file_id=f.attributes['id'] file_name=@db.select_one("select file_name from file WHERE file_id=? and cd_id=?",file_id,cd).to_s oInfo=AudioInfo::Virtual.new(cd,file_name) f.elements.each("*") {|e| oInfo.send(e.name+"=",e.text) if !e.text.nil? } @archivos.push(oInfo) } end |