Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Paste Description for add_tagcache.patch

Use a struct mp3entry instead of a struct trackinfo for temporary storage of the metadata.

add_tagcache.patch
Monday, October 1st, 2007 at 6:22:43pm UTC 

  1. Index: apps/tagcache.c
  2. ===================================================================
  3. --- apps/tagcache.c     (rĂ©vision 14941)
  4. +++ apps/tagcache.c     (copie de travail)
  5. @@ -1608,7 +1608,7 @@
  6.  static void add_tagcache(char *path)
  7.  #endif
  8.  {
  9. -    struct track_info track;
  10. +    struct mp3entry id3;
  11.      struct temp_file_entry entry;
  12.      bool ret;
  13.      int fd;
  14. @@ -1657,10 +1657,10 @@
  15.          return ;
  16.      }
  17.  
  18. -    memset(&track, 0, sizeof(struct track_info));
  19. +    memset(&id3, 0, sizeof(struct mp3entry));
  20.      memset(&entry, 0, sizeof(struct temp_file_entry));
  21.      memset(&tracknumfix, 0, sizeof(tracknumfix));
  22. -    ret = get_metadata(&(track.id3), fd, path);
  23. +    ret = get_metadata(&id3, fd, path);
  24.      close(fd);
  25.  
  26.      if (!ret)
  27. @@ -1669,7 +1669,7 @@
  28.      logf("-> %s", path);
  29.      
  30.      /* Generate track number if missing. */
  31. -    if (track.id3.tracknum <= 0)
  32. +    if (id3.tracknum <= 0)
  33.      {
  34.          const char *p = strrchr(path, '.');
  35.          
  36. @@ -1689,52 +1689,52 @@
  37.          
  38.          if (tracknumfix[0] != '\0')
  39.          {
  40. -            track.id3.tracknum = atoi(tracknumfix);
  41. +            id3.tracknum = atoi(tracknumfix);
  42.              /* Set a flag to indicate track number has been generated. */
  43.              entry.flag |= FLAG_TRKNUMGEN;
  44.          }
  45.          else
  46.          {
  47.              /* Unable to generate track number. */
  48. -            track.id3.tracknum = -1;
  49. +            id3.tracknum = -1;
  50.          }
  51.      }
  52.      
  53.      /* Numeric tags */
  54. -    entry.tag_offset[tag_year] = track.id3.year;
  55. -    entry.tag_offset[tag_discnumber] = track.id3.discnum;
  56. -    entry.tag_offset[tag_tracknumber] = track.id3.tracknum;
  57. -    entry.tag_offset[tag_length] = track.id3.length;
  58. -    entry.tag_offset[tag_bitrate] = track.id3.bitrate;
  59. +    entry.tag_offset[tag_year] = id3.year;
  60. +    entry.tag_offset[tag_discnumber] = id3.discnum;
  61. +    entry.tag_offset[tag_tracknumber] = id3.tracknum;
  62. +    entry.tag_offset[tag_length] = id3.length;
  63. +    entry.tag_offset[tag_bitrate] = id3.bitrate;
  64.      
  65.      /* String tags. */
  66. -    has_albumartist = track.id3.albumartist != NULL
  67. -        && strlen(track.id3.albumartist) > 0;
  68. -    has_grouping = track.id3.grouping != NULL
  69. -        && strlen(track.id3.grouping) > 0;
  70. +    has_albumartist = id3.albumartist != NULL
  71. +        && strlen(id3.albumartist) > 0;
  72. +    has_grouping = id3.grouping != NULL
  73. +        && strlen(id3.grouping) > 0;
  74.  
  75.      ADD_TAG(entry, tag_filename, &path);
  76. -    ADD_TAG(entry, tag_title, &track.id3.title);
  77. -    ADD_TAG(entry, tag_artist, &track.id3.artist);
  78. -    ADD_TAG(entry, tag_album, &track.id3.album);
  79. -    ADD_TAG(entry, tag_genre, &track.id3.genre_string);
  80. -    ADD_TAG(entry, tag_composer, &track.id3.composer);
  81. -    ADD_TAG(entry, tag_comment, &track.id3.comment);
  82. +    ADD_TAG(entry, tag_title, &id3.title);
  83. +    ADD_TAG(entry, tag_artist, &id3.artist);
  84. +    ADD_TAG(entry, tag_album, &id3.album);
  85. +    ADD_TAG(entry, tag_genre, &id3.genre_string);
  86. +    ADD_TAG(entry, tag_composer, &id3.composer);
  87. +    ADD_TAG(entry, tag_comment, &id3.comment);
  88.      if (has_albumartist)
  89.      {
  90. -        ADD_TAG(entry, tag_albumartist, &track.id3.albumartist);
  91. +        ADD_TAG(entry, tag_albumartist, &id3.albumartist);
  92.      }
  93.      else
  94.      {
  95. -        ADD_TAG(entry, tag_albumartist, &track.id3.artist);
  96. +        ADD_TAG(entry, tag_albumartist, &id3.artist);
  97.      }
  98.      if (has_grouping)
  99.      {
  100. -        ADD_TAG(entry, tag_grouping, &track.id3.grouping);
  101. +        ADD_TAG(entry, tag_grouping, &id3.grouping);
  102.      }
  103.      else
  104.      {
  105. -        ADD_TAG(entry, tag_grouping, &track.id3.title);
  106. +        ADD_TAG(entry, tag_grouping, &id3.title);
  107.      }
  108.      entry.data_length = offset;
  109.      
  110. @@ -1743,27 +1743,27 @@
  111.      
  112.      /* And tags also... Correct order is critical */
  113.      write_item(path);
  114. -    write_item(track.id3.title);
  115. -    write_item(track.id3.artist);
  116. -    write_item(track.id3.album);
  117. -    write_item(track.id3.genre_string);
  118. -    write_item(track.id3.composer);
  119. -    write_item(track.id3.comment);
  120. +    write_item(id3.title);
  121. +    write_item(id3.artist);
  122. +    write_item(id3.album);
  123. +    write_item(id3.genre_string);
  124. +    write_item(id3.composer);
  125. +    write_item(id3.comment);
  126.      if (has_albumartist)
  127.      {
  128. -        write_item(track.id3.albumartist);
  129. +        write_item(id3.albumartist);
  130.      }
  131.      else
  132.      {
  133. -        write_item(track.id3.artist);
  134. +        write_item(id3.artist);
  135.      }
  136.      if (has_grouping)
  137.      {
  138. -        write_item(track.id3.grouping);
  139. +        write_item(id3.grouping);
  140.      }
  141.      else
  142.      {
  143. -        write_item(track.id3.title);
  144. +        write_item(id3.title);
  145.      }
  146.      total_entry_count++;   
  147.  }

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right