view · edit · sidebar · attach · print · history

20121121-update-oddb2xml-just-medical-lookandfeel

<< | Index | >>


Summary

  • Update -t option as flexible.
    • Update to use also as filename (oddb_product.xml => md_product.xml)
  • Add zip compress option

Commits

oddb2xml
ch.oddb

Index


Update tag suffix option

commit
$ bin/oddb2xml --help
bin/oddb2xml ver.1.0.7
Usage:
  oddb2xml [option]
    -c F, --compress=F   Compress format F. Currently only 'tar.gz' is available.
    -a T, --append=T     Additional target. T, only 'nonpharma' is available.
    -t S, --tag-suffix=S XML tag suffix S. Default is none. [A-z0-9_]
                         If S is given, it is also used as prefix of filename.
    -h,   --help         Show this help message.

Update filename

Update to use tag-suffix option also as filename (like md_product.xml, md_article.xml)

commit
$ bin/oddb2xml --help
bin/oddb2xml ver.1.0.7
Usage:
  oddb2xml [option]
    -c F, --compress=F   Compress format F. Currently only 'tar.gz' is available.
    -a T, --append=T     Additional target. T, only 'nonpharma' is available.
    -t S, --tag-suffix=S XML tag suffix S. Default is none. [A-z0-9_]
                         If S is given, it is also used as prefix of filename.          # => HERE
    -h,   --help         Show this help message.

Add zip compress option

Added zip option.

be bin/oddb2xml --help
bin/oddb2xml ver.1.0.7
Usage:
  oddb2xml [option]
    -c F, --compress=F   Compress format F. {tar.gz|zip}
    -a T, --append=T     Additional target. T, only 'nonpharma' is available.
    -t S, --tag-suffix=S XML tag suffix S. Default is none. [A-z0-9_]
                         If S is given, it is also used as prefix of filename.
    -h,   --help         Show this help message.
commit

Ref.


Todo for oddb2xml

To add specs

  • extractor class
  • builder class

Update just medical lookandfeel feeds

oddb.org has rss feed as static file (passthru).
We cannot change dynamically links in rss file.

src/state/global.rb

      def rss
        if(channel = @session.user_input(:channel))
          key = channel.gsub('.', '_').to_sym
          if(@session.lookandfeel.enabled?(key))
            Rss::PassThru.new(@session, channel)
          else
            Http404.new(@session, nil)
          end
        end
      end

Updated to use flavored rss feed.

      def rss
        if(channel = @session.user_input(:channel))
          key = channel.gsub('.', '_').to_sym
          if(@session.lookandfeel.enabled?(key))
            if @session.flavor != Session::DEFAULT_FLAVOR
              channel = File.basename(channel, '.rss') + '-' + \
                        @session.flavor + '.rss'
            end  
            Rss::PassThru.new(@session, channel)
          else 
            Http404.new(@session, nil) 
          end  
        end  
      end
  • [lang]/recall-just-medical.rss
  • [lang]/hpc-just-medical.rss

And, created a method to generate flavored rss file for update job.

commit

But production server has encoding error.

thinpower oddb.org # RUBY_OPT="" bin/admin 
ch.oddb> RssPlugin.new(self).generate_flavored_rss('recall.rss')
-> invalid byte sequence in US-ASCII
ch.oddb> RssPlugin.new(self).generate_flavored_rss('hpc.rss')
-> invalid byte sequence in US-ASCII
ch.oddb> 

run as Job.
Then this copy method has worked with no error.

view · edit · sidebar · attach · print · history
Page last modified on November 21, 2012, at 10:11 AM