List_match using a text file?

Hi,
Actually I am using a pretty ugly way to accept/reject music entries, it is the following:

music-config:                                                                                                                                                                                          
  accept_all: True                                                               
  regexp:                                                                        
    reject_excluding:                                                            
      - '^(Artist 1|Artist 2|Artist 3|...|Artist N) - .* FLAC'

The thing is that I am following a LOT of artists so I end up with a looooong regexp.

Is there a way to do something like:

type or paste config/log snippets here
music-config:                                                                                                                                                                                          
  list_match:
    from:
      - file_list: /path/to/input/list.txt # this does not exists
  regexp:                                                                        
    reject_excluding:                                                            
      - 'FLAC'

And the file containing something like 1 Artist per line, or something in this fashion?

Thanks!
POGMAN

Maybe you can experiment with the variables plugin?

Hmmm, I did that at first but instead of having a huuuuge string in config.yml it would be hidden in variables.yml, which is not ideal. :stuck_out_tongue:

I did not push this too far for another reason, with the string as a variable my regex would not work anymore. I guess this is due to some artist having special chars ($,*,etc.) in their names, some escaping might fix that though.

You could use list_match with the regexp_list plugin. If you want to populate the regexp_list from a text file, you could make another task that clears and loads the regexp_list using csv plugin, or some other plugin that reads text files as an input.

Nice solution indeed, it looks like that now:

artists-init:                                          
  disable: seen
  list_clear:                                           
    what:                                               
      - regexp_list: artists                            
  csv:                                                  
    url: file:///path/to/artists.csv         
    values:                                             
      title: 1                                          
      url: 2                                            
  list_add:                                             
    - regexp_list: artists                              
  accept_all: yes                                       
                                                        
music-config:                                                    
  list_match:                                           
    from:                                               
      - regexp_list: artists                            
    remove_on_match: no                                 
    single_match: no                                    
  regexp:                                               
    reject_excluding:                                   
      - 'FLAC'

Only downside is that the URL is mandatory in the CSV, leaving it empty works though. Nothing to worry about

Nice work, exactly what I had in mind. :slightly_smiling_face: