[REL][SE] discshop.se

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
surfmike
Posts: 5
Joined: 2008-03-05 09:05:07

Post by surfmike »

THX bad4you (pls rename to good4you) =)
surfmike
Posts: 5
Joined: 2008-03-05 09:05:07

Post by surfmike »

One small addition:

To receive correct "translated title", use this code from line 148:

---------------------------------------------------------

// Translated Title
if CanSetField(fieldTranslatedTitle) then
begin
Value := '';
Value := TextBetween(PageText, '<title>', ' - Discshop.se</title>');
HTMLDecode(Value);
SetField(fieldTranslatedTitle, Value);
end;

---------------------------------------------------------
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

This won't work either.

Seems that some films appear as "Discshop.se - Movietitle" and others as "Movietitle - Discshop.se". (i.e. search for "Agnes Cecilia - en sällsam historia").

I will have a look on it tonight, if noone finds a solution for it before ;)

Edit: Sorry, "Agnes Cecilia - en sällsam historia" is not found on movie search but on 'Sökresultat: Övriga filmträffar' - whatever that means ;).
Nethertheless there are/were movies that use other format during testing, else I would not have used the textafter function.
Last edited by bad4u on 2008-03-27 21:21:40, edited 1 time in total.
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

Code: Select all

 // Translated Title
if CanSetField(fieldTranslatedTitle) then
begin
Value := '';
Value := TextBetween(PageText, '<title>', '</title>');
Value := StringReplace(Value, 'Discshop.se - ', '');
Value := StringReplace(Value, ' - Discshop.se', '');
HTMLDecode(Value);
SetField(fieldTranslatedTitle, Value);
end; 
I have no access to AMC to do some tests now, but this should solve the problem..
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

discshop.se 1.0.1: http://www.bad4u.741.com/full/discshop.se.ifs (copy link into a NEW browser window !)

It contains the code from my posting above, as this works for both versions of 'translated titles'. Thanks surfmike ;)
switchcore
Posts: 1
Joined: 2008-05-06 20:16:16

Post by switchcore »

lovely script ... works good.

would like it to find my music-dvd´s also if possible.

thanks
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

switchcore wrote:would like it to find my music-dvd´s also if possible.
Open AMC script editor and simply change every 'movies' on the script to 'music' (there must be 7 'movies' inside, only the word movies - not movie without the s !), and save the script to a new name (discshop_music or similar). Et voilá, you can search and import music dvd.

Music DVDs could be quite easily added to the script as an option, but I do not have time for it now.. maybe someone else wants to do this, else I could add it later (but I cannot promise when).
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

switchcore wrote:would like it to find my music-dvd´s also if possible.
I added a new option 'FilmOrMusic' to search discshop.se music-dvd section.

discshop.se 1.1.0: http://www.bad4u.741.com/full/discshop.se.ifs (copy link into a NEW browser window !)
u28151
Posts: 6
Joined: 2007-10-02 18:36:44

Not working anymore...

Post by u28151 »

When running script towards Discshop.se only 1 string "discshop.se" is returned.
Is it possible to have you look into this? :-)

Regards

//Ulf
neorules
Posts: 26
Joined: 2009-10-28 18:00:25

Not working anymore...

Post by neorules »

I hope anywone can fix this script
neorules
Posts: 26
Joined: 2009-10-28 18:00:25

Post by neorules »

This is the reply I got from bad4u

"I do not have time to work on this script at the moment, as it needs a complete workover, not just some bugfixes. Seems website structure changed mainly."

Maybe someone else can tackle this and make it work
neorules
Posts: 26
Joined: 2009-10-28 18:00:25

Post by neorules »

Is there no one who can get this script to work. There is no script that is made for Swedish text what I've found, but is there anyone who can tell if there is one that is made to get from the Swedish site
neorules
Posts: 26
Joined: 2009-10-28 18:00:25

Post by neorules »

Is there really nobody who can fix a script in Swedish please
zerokool
Posts: 1
Joined: 2009-12-14 19:46:28

Post by zerokool »

bad4u wrote:
switchcore wrote:would like it to find my music-dvd´s also if possible.
I added a new option 'FilmOrMusic' to search discshop.se music-dvd section.

discshop.se 1.1.0: http://www.bad4u.741.com/full/discshop.se.ifs (copy link into a NEW browser window !)
Would be great if the link had worked.
Its gone a year now and the scrips havent been updated.
U might as well shut down the site since nothing is working anymore :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry:
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Shut down which site?
Many of the scripts are updated. That one isn't, but I do not have time to update all the scripts which require an update unfortunately.
neorules
Posts: 26
Joined: 2009-10-28 18:00:25

Post by neorules »

pity that there is not a script for a Swedish site
neorules
Posts: 26
Joined: 2009-10-28 18:00:25

Post by neorules »

Is it really just me wanting a script to a Swedish site
HMC
Posts: 2
Joined: 2010-01-03 02:07:13

Post by HMC »

I have rewritten some of the code in Discshop v1.1.0 script.
It might need more updates but feel free to test it.

Code: Select all

(***************************************************

Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/

[Infos]
Authors=Håkan M
Title=Discshop 1.1.1
Description=Import data & picture from www.discshop.se in swedish
Site=www.discshop.se
Language=SE
Version=1.1.1
Requires=3.5.0
Comments=Based on the Discshop-script (v.1.1.0) made by Andreas Fridvall|Updated & modified by Håkan M
License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
GetInfo=1

[Options]
BatchMode=0|0|0=Normal working mode, prompts user when needed (default)|1=Does not display any window, takes the first movie found
MultipleValuesActors=3|3|0=Only take first value for Actors|1=Take full list, separated by commas|2=Take full list, separated by slashes (default)|3=Take full list, separated by linebreaks
MultipleValuesCountry=1|1|0=Only take first value for Country|1=Take full list, separated by commas (default)|2=Take full list, separated by slashes
MultipleValuesCategory=1|1|0=Only take first value for Category|1=Take full list, separated by commas (default)|2=Take full list, separated by slashes
MultipleValuesLanguages=1|1|0=Only take first value for Languages|1=Take full list, separated by commas (default)|2=Take full list, separated by slashes
FilmOrMusic=0|0|0=Search for movies (default)|1=Search for music-dvd

***************************************************)

program Discshop;

uses
  StringUtils1;

var
  MovieList: string;
  MovieName: string;
  MovieURL: string;
  MovieNumber: string;
  SearchID: string;
  SubSite: string;
  StartPos: integer;
  MovieListLength: integer;
  ListEmpty: integer;
  
// ***** analyzes the results page that asks to select a movie from a list *****

procedure AnalyzeResultsPage(Address: string);
var
  PageText: string;
  Value: string;
begin
  PageText := GetPage(Address);

  if GetOption('BatchMode') = 0 then
  begin

    // No movies were found
    if Pos('Listar alla 0 produkter...', PageText) <> 0 then
    begin
      ShowMessage('No movie found for this search');
      Exit;
    end;

    // Only one movie was found
    if Pos('Listar alla 1 produkter...', PageText) <> 0 then
    begin
      MovieNumber := TextBetween(PageText, 'ds.php?red=ds_produkt.php&&arg=id@@@', ',,,');
      MovieURL := 'http://www.discshop.se/shop/ds_produkt.php?subsite=' + SubSite +'&id=' + MovieNumber;
      PageText := GetPage(MovieURL);
      AnalyzeMoviePage(PageText);
      Exit;
    end;

    // More that one movie was found
    PickTreeClear;
	  ListEmpty := 1;
    MovieList := TextBetween(PageText, '<form action="search_solr.php?ref=&lang=se&subsite=movies&cont=ds"', '</form>');

    while ListEmpty = 1 do
    begin
      if Pos('style="height:75px;">', MovieList) <> 0 then
      begin
        StartPos := Pos('style="height:75px;">', MovieList)+21;
        MovieList := Copy(MovieList, StartPos ,Length(MovieList)-StartPos);
      end
      else
      begin
        MovieList := '';
      end;

      MovieNumber := TextBetween(MovieList, 'ds.php?red=ds_produkt.php&&arg=id@@@', ',,,');
      MovieURL := 'http://www.discshop.se/shop/ds_produkt.php?subsite=' + SubSite +'&id=' + MovieNumber;
      MovieName := TextBetween(MovieList, 'title=""><b>', '</b>');

      // If a movie was found
      if MovieName <> '' then
      begin
        // Add it to the tree
        HTMLDecode(MovieName);
        HTMLRemoveTags(MovieName);
        PickTreeAdd(MovieName, MovieURL);
        MovieName :='';
        ListEmpty := 1;
      end
      else
      begin
        ListEmpty := 0;
      end;
    end;

    if PickTreeExec(MovieURL) then
    begin
      PageText := GetPage(MovieURL);
      AnalyzeMoviePage(PageText);
    end;
  end
  else
  begin

    if Pos('Listar alla 0 produkter...', PageText) <> 0 then
    begin
      // BatchNo movies were found
      Exit;
    end
    else
    begin
      // Batch mode, pick the first available movie
      MovieNumber := TextBetween(PageText, 'ds.php?red=ds_produkt.php&&arg=id@@@', ',,,');
      MovieURL := 'http://www.discshop.se/shop/ds_produkt.php?subsite=' + SubSite +'&id=' + MovieNumber;
      PageText := GetPage(MovieURL);
      AnalyzeMoviePage(PageText);
      Exit;
    end;
  end;
end;

// ***** analyzes the page containing movie information *****

procedure AnalyzeMoviePage(PageText: string);
var
  Value, Value2, Value3: string;
  p: Integer;
  rating : Real;
begin
  MovieNumber := TextBetween(PageText, 'ds.php?red=ds_produkt.php&&arg=id@@@', ',,,');
  MovieURL := 'http://www.discshop.se/shop/ds_produkt.php?subsite=' + SubSite + '&id=' + MovieNumber;
 
  // URL
  if CanSetField(fieldURL) then
    SetField(fieldURL, MovieURL);

  // Translated Title
  if CanSetField(fieldTranslatedTitle) then
  begin
    Value := '';
    Value := TextBetween(PageText, '<title>', '</title>');
    Value := StringReplace(Value, 'Discshop.se - ', '');
    Value := StringReplace(Value, ' - Discshop.se', '');
    HTMLDecode(Value);
    SetField(fieldTranslatedTitle, Value);
  end;

  // Original Title
  if CanSetField(fieldOriginalTitle) then
  begin
    Value := '';
    Value := TextBetween(PageText, 'Originaltitel:', '<div class="clfix"></div>');
    Value := TextBetween(Value, '<div class="item2">', '</div>');
    HTMLDecode(Value);
    SetField(fieldOriginalTitle, Value);
  end;

  // Year
  if CanSetField(fieldYear) then
  begin
    Value := '';
    Value := TextBetween(PageText, 'Premiärår:', '<div class="clfix"></div>');
    Value := TextBetween(Value, '<div class="item2">', '</div>');
    HTMLDecode(Value);
    SetField(fieldYear, Value);
  end;

  // Length
  if CanSetField(fieldLength) then
  begin
    Value := '';
    Value := TextBetween(PageText, 'Speltid:', '<div class="clfix"></div>');
    Value := TextBetween(Value, '<div class="item2">', ' min</div>');
    HTMLDecode(Value);
    SetField(fieldLength, Value);
  end;

  // Director
  if CanSetField(fieldDirector) then
  begin
    Value := '';
    Value := TextBetween(PageText, 'Regi:', '<div class="clfix"></div>');
    Value := TextBetween(Value, '<div class="item2">', '</div>');
    Value := StringReplace(Value, '<BR>', ', ');
    Value := StringReplace(Value, '<br>', ', ');
    Value := StringReplace(Value, #13#10, '');
    Value := StringReplace(Value, #09,'');
    Value := StringReplace(Value, '  ', '');
    HTMLRemoveTags(Value);
    HTMLDecode(Value);
    SetField(fieldDirector, Value);
  end;

  // Rating
  if CanSetField(fieldRating) then
  begin
    Value := '';
    Value := TextBetween(PageText, '<div class="rate1">', '</div>');
    Value := StringReplace(Value, '<img src="img/design/v5/rate_big_1.gif" border=0>', '1');
    Value := StringReplace(Value, '<img src="img/design/v5/rate_big_05.gif" border=0>', '5');
    Value := StringReplace(Value, '<img src="img/design/v5/rate_big_0.gif" border=0>', '0');
    case Value of
      '00000' : Value := '0';
      '50000' : Value := '1';
      '10000' : Value := '2';
      '15000' : Value := '3';
      '11000' : Value := '4';
      '11500' : Value := '5';
      '11100' : Value := '6';
      '11150' : Value := '7';
      '11110' : Value := '8';
      '11115' : Value := '9';
      '11111' : Value := '10';
     end;
    SetField(fieldRating, Value);
  end;

  // Resolution
  if CanSetField(fieldResolution) then
  begin
    Value := '';
    Value := TextBetween(PageText, 'Bild:', '<div class="clfix"></div>');
    Value := TextBetween(Value, '<div class="item2">', '</div>');
    Value := StringReplace(Value, #13#10, '');
    Value := StringReplace(Value, #09,'');
    Value := StringReplace(Value, '(anamorfisk)','');
    HTMLDecode(Value);
    SetField(fieldResolution, Value);
  end;

  // VideoFormat
  if CanSetField(fieldVideoFormat) then
  begin
    Value := '';
    Value := TextBetween(PageText, 'Format:', '<div class="clfix"></div>');
    Value := TextBetween(Value, '<div class="item2">', '</div>');
    Value := StringReplace(Value, #13#10, '');
    Value := StringReplace(Value, #09,'');
    while Pos(' ', Value) = 1 do
      Value := Copy(Value, 2, Length(Value));
    while Pos('  ', Value) > 0 do
      Value := StringReplace(Value, '  ', '');
    HTMLDecode(Value);
    SetField(fieldVideoFormat, Value);
  end;

// MediaType
  if CanSetField(fieldMediaType) then
  begin
    Value := '';
    Value := TextBetween(PageText, 'Kartong:', '<div class="clfix"></div>');
    Value := TextBetween(Value, '<div class="item2">', '</div>');
    HTMLDecode(Value);
    SetField(fieldMediaType, Value);
  end;

  // Writer (Producer Field)
  if CanSetField(fieldProducer) then
  begin
    Value := '';
    Value := TextBetween(PageText, 'Manus:', '<div class="clfix"></div>');
    Value := TextBetween(Value, '<div class="item2">', '</div>');
    Value := StringReplace(Value, '<BR>', ', ');
    Value := StringReplace(Value, '<br>', ', ');
    Value := StringReplace(Value, '<br/>', ', ');
    Value := StringReplace(Value, '<BR/>', ', ');
    Value := StringReplace(Value, #13#10, '');
    Value := StringReplace(Value, #09,'');
    while Pos(' ', Value) = 1 do
      Value := Copy(Value, 2, Length(Value));
    while Pos('  ', Value) > 0 do
      Value := StringReplace(Value, '  ', '');
    HTMLRemoveTags(Value);
    HTMLDecode(Value);
    SetField(fieldProducer, Value);
  end;

  // Picture
  if CanSetPicture then
  begin
    Value := '';
    Value := TextBetween(PageText, '<img src="http://www.discshop.se/shop/img/omslag/front_normal/','"');
    if Value <> '' then
      Value := 'http://www.discshop.se/shop/img/omslag/front_large/' + Value;
      GetPicture(Value);
  end;

  // Discs
  SetField(fieldDisks, ImportList(PageText, GetOption('MultipleValuesDisks'), 'Antal skivor:'));

  // Country
  if CanSetField(fieldCountry) then
    SetField(fieldCountry, ImportList(PageText, GetOption('MultipleValuesCountry'), 'Produktionsland:'));

  // Category
  if CanSetField(fieldCategory) then
    SetField(fieldCategory, ImportList(PageText, GetOption('MultipleValuesCategory'), 'Genre:'));

	// Language
  if CanSetField(fieldLanguages) then
  begin
    Value := '';
    Value := TextBetween(PageText, 'Ljud:', '<div class="clfix"></div>');
    Value := TextBetween(Value, '<div id="specifikationer_sprak_alla" style="display:none;">', '</div>');
    // Value := Copy(Value,1,LastPos('<br>',Value)-1);
    Value := StringReplace(Value, #13#10,'');
    Value := StringReplace(Value, #09,'');
    Value := StringReplace(Value, ' ','');
    case GetOption('MultipleValuesLanguages') of
      0: if Pos('<br>',Value)>0 then Value := TextBefore(Value, '<br>', '');
      1: Value := StringReplace(Value, '<br/>', ', ');
      2: Value := StringReplace(Value, '<br/>', ' / ');
      3: Value := StringReplace(Value, '<br/>', #13#10);
    end;
    HTMLRemoveTags(Value);
    HTMLDecode(Value);
    while Pos(' ', Value) = 1 do
      Value := Copy(Value, 2, Length(Value));
    while Pos('  ', Value) > 0 do
      Value := StringReplace(Value, '  ', '');
    while Pos(' ', Value) = Length(Value)-1 do
      Value := Copy(Value, 0, Length(Value)-1);
    while Pos(',', Value) = Length(Value)-1 do
      Value := Copy(Value, 0, Length(Value)-2);
    // Remove the last ', ' in the row
    Value2 := Copy(Value, Length(Value)-1, 2);
    if Value2 = ', ' then Value := Copy(Value, 0, Length(Value)-2);

    SetField(fieldLanguages, Value);
  end;

  // Subtitles
  if CanSetField(fieldSubtitles) then
  begin
    Value := '';
    Value := TextBetween(PageText, 'Text:', '<div class="clfix"></div>');
    Value := StringReplace(Value, #13#10,'');
    Value := StringReplace(Value, #09,'');
    Value := StringReplace(Value, ' ', '');
    Value := StringReplace(Value, '<br/>', ', ');

    Value2 := TextBetween(Value, '<div id="specifikationer_text" style="display:none;">','</div>');
    // discshop uses two diffrent layouts for subtitle listnings
    if Value2='' then
    begin
      Value3 := Copy(Value,1,LastPos('<br/>',Value)-1);  // remove the last <br>
      Value3 := StringReplace(Value3, '<br/>', ', ');
    end
    else
    begin
      Value := RemainingText;
      Value3 := '';
      while Value2 <> '' do
      begin
        if Value3='' then
          Value3 := Value2
        else
          Value3 := Value3 + ', ' + Value2;
        Value2 := TextBetween(Value, '<TD>','</TD>');
        Value := RemainingText;
      end;
    end;
    while Pos(' ', Value3) = 1 do
      Value3 := Copy(Value3, 2, Length(Value3));
    Value3 := StringReplace(Value3, ',  ', '');
    while Pos('  ', Value3) > 0 do
      Value3 := StringReplace(Value3, '  ', ' ');
    // Add ', ' instead of space between subtitles
    // Value3 := StringReplace(Value3, ' ', ', ');
    // Remove the last ', ' in the row
    //Value3 := Copy(Value3, 0, Length(Value3)-2);
    // Replace ',,' with ','
    // Value3 := StringReplace(Value3, ',,', ',');

    HTMLRemoveTags(Value3);
    HTMLDecode(Value3);
    SetField(fieldSubtitles, Value3);
  end;

  // Actors
  if CanSetField(fieldActors) then
    SetField(fieldActors, ImportList(PageText, GetOption('MultipleValuesActors'), 'Skådespelare:'));

  // Description
  if CanSetField(fieldDescription) then
  begin
    Value := '';
    Value := TextBetween(PageText,'Filmens handling:', '</p>');
    if Value = '' then
      Value := TextBetween(PageText, 'Filmens handling', '</p>');
    if Value = '' then
      Value := TextBetween(PageText, 'Beskrivning:', '</p>');
    Value := StringReplace(Value, '    ', '');
    Value := StringReplace(Value, 'disableSelection(document.getElementById("text_handling"));', '');
    Value := StringReplace(Value, TextBetween(Value, '<span style="display: none;">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style=" display: none;">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style=" display: none">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style="display: none">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style="display: none;">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style=" display: none;">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style=" display: none">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style="display: none">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style="display: none;">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style=" display: none;">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style=" display: none">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style="display: none">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style="display:none;">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style=" display:none;">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style=" display:none">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span style="display:none">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style="display:none;">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style=" display:none;">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style=" display:none">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i style="display:none">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style="display:none;">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style=" display:none;">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style=" display:none">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b style="display:none">', '</b>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<span class="infoText1234">', '</span>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<i class="infoText1234">', '</i>'),'');
    Value := StringReplace(Value, TextBetween(Value, '<b class="infoText1234">', '</b>'),'');
    Value := StringReplace(Value, '<FONT COLOR="white">i</FONT>', ' ');
    Value := StringReplace(Value, #13#10,'');
    Value := StringReplace(Value, #09,'');
    Value := StringReplace(Value, '<br>', #13#10);
    Value := StringReplace(Value, ' Informationen kopierad från discshop.se!','');
    Value := StringReplace(Value, ' Info kopierad från discs hop.se!','');
    Value := StringReplace(Value, ' Informationen är tagen från discshop.se!','');
    Value := StringReplace(Value, ' Informationen är tagen från disc shop.se!','');
    Value := StringReplace(Value, ' Informationen hämtad från discshop.se!','');
    Value := StringReplace(Value, ' Över 15.000 titlar i lager.','');
    Value := StringReplace(Value, ' Över 18.000 titlar i lager.','');
    Value := StringReplace(Value, ' Leverans nästa dag.','');
    Value := StringReplace(Value, ' Leverans nästa dag.','');
    Value := StringReplace(Value, ' Leverans nästa dag om du beställer före 16.00.','');
    Value := StringReplace(Value, ' Leverans nästa dag om du beställer före 16.00.','');
    Value := StringReplace(Value, ' Beställ före 16.00.','');
    Value := StringReplace(Value, ' Beställ före 16.00, leverans nästa dag.','');
    Value := StringReplace(Value, ' Köp den på www.discshop.se idag!.','');
    HTMLRemoveTags(Value);
    HTMLDecode(Value);
    SetField(fieldDescription, Value);
  end;

  // Reviews
 if CanSetField(fieldComments) then
  begin
    Value3 := '';
    Value3 := TextBetween(PageText, '<div class="ds_omdomme_cust">', 'Läs alla omdömen');
    Value3 := StringReplace(Value3, #9, '');
    Value3 := StringReplace(Value3, '         ', '');
    Value3 := StringReplace(Value3, '<b> ', 'Betyg: ');
    Value3 := StringReplace(Value3, '</b></font>', '/5.0');
    Value3 := StringReplace(Value3, TextBetween(Value3, 'HSPACE=6 BORDER=0>', '</A>'),'');
    while Pos(' ', Value3) = 1 do
      Value3 := Copy(Value, 2, Length(Value3));
    while Pos('  ', Value3) > 0 do
      Value3 := StringReplace(Value3, '  ', '');
    while Pos(#13#10 + ' ', Value3) > 0 do
      Value3 := StringReplace(Value3, #13#10 + ' ', ' ');
    HTMLRemoveTags(Value3);
    HTMLDecode(Value3);
    Value3 := FullTrim(Value3);
    SetField(fieldComments, Value3);
  end;
end;

// ***** Imports lists like Genre, Country, etc. depending of the selected option *****

function ImportList(PageText: string; MultipleValues: Integer; StartTag: string): string;
var
  Value: string;
begin
  Value := '';
  Value := TextBetween(PageText, StartTag, '<div class="clfix"></div>');
  Value := TextBetween(Value, '<div class="item2">', '</div>');
  Value := StringReplace(Value, #13#10,'');
  Value := StringReplace(Value, #09,'');
  Value := StringReplace(Value, '<br/>','<BR>');   // separator for categories
  Value := StringReplace(Value, '</br>','<BR>');
  Value := StringReplace(Value, ' / ','<BR>');   // separator for some countries
  while Pos(' ', Value) = 1 do
    Value := Copy(Value, 2, Length(Value));
  while Pos('  ', Value) > 0 do
    Value := StringReplace(Value, '  ', '');
  case MultipleValues of
  0: if Pos('<BR>',Value)>0 then Value := TextBefore(Value, '<BR>', '');
  1: Value := StringReplace(Value, '<BR>', ', ');
  2: Value := StringReplace(Value, '<BR>', ' / ');
  3: Value := StringReplace(Value, '<BR>', #13#10);
  end;
  HTMLRemoveTags(Value);
  HTMLDecode(Value);
  Result := Value;
end;

// ***** beginning of the program *****

begin
  if CheckVersion(3,5,0) then
  begin
    case GetOption('FilmOrMusic') of
      0 : SubSite := 'movies';
      1 : SubSite := 'music';
    end;
    MovieName := '';

    if GetOption('BatchMode') = 2 then
    begin
      MovieName := GetField(fieldURL);
      if Pos('discshop.se', MovieName) = 0 then
        MovieName := '';
    end;

    if MovieName = '' then
      MovieName := GetField(fieldOriginalTitle);
    if MovieName = '' then
      MovieName := GetField(fieldTranslatedTitle);

    if GetOption('BatchMode') = 0 then
    begin
      if not Input('Discshop.se import', 'Enter the title of the movie:', MovieName) then
        Exit;
    end
    else
      Sleep(500);
    if MovieName <> '' then
    begin
      if Pos('discshop.se', MovieName) > 0 then
        AnalyzeResultsPage(MovieName)
      else
      begin
        MovieName := StringReplace(MovieName, '&', 'and');
        AnalyzeResultsPage('http://www.discshop.se/shop/search_solr.php?lang=&cont=ds&soktext=' + UrlEncode(MovieName) + '&subsite_set=' + SubSite + '&lang=se&subsite=movies&&ref=')
      end;
    end;
  end
  else
    ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
end.
neorules
Posts: 26
Joined: 2009-10-28 18:00:25

Post by neorules »

HMC wrote:I have rewritten some of the code in Discshop v1.1.0 script.
It might need more updates but feel free to test it.

As I said in another thread you are a star
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

HMC wrote:I have rewritten some of the code in Discshop v1.1.0 script.
Thanks.
I guess it deserves a 1.2.0 version at least :D btw I removed the version number from the title: better to keep same title as previous script, some settings are remembered on basis of the title if I remember well...
Post Reply