انتقال انتخاب نوع import از کنترلر api به سرویس IArtifactService
This commit is contained in:
parent
90d7140716
commit
47b718dcef
@ -1091,37 +1091,7 @@ namespace RMuseum.Controllers
|
||||
public async Task<IActionResult> Import(string srcType, string resourceNumber, string friendlyUrl, string resourcePrefix)
|
||||
{
|
||||
RServiceResult<bool> res =
|
||||
srcType == "princeton" ?
|
||||
await _artifactService.StartImportingFromPrinceton(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "harvard" ?
|
||||
await _artifactService.StartImportingFromHarvard(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "qajarwomen" ?
|
||||
await _artifactService.StartImportingFromHarvardDirectly(resourceNumber, friendlyUrl, resourcePrefix)
|
||||
:
|
||||
srcType == "hathitrust" ?
|
||||
await _artifactService.StartImportingFromHathiTrust(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "penn" ?
|
||||
await _artifactService.StartImportingFromPenLibraries(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "cam" ?
|
||||
await _artifactService.StartImportingFromCambridge(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "bl" ?
|
||||
await _artifactService.StartImportingFromBritishLibrary(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "folder" ?
|
||||
await _artifactService.StartImportingFromServerFolder(resourceNumber, friendlyUrl, resourcePrefix)
|
||||
:
|
||||
srcType == "walters" ?
|
||||
await _artifactService.StartImportingFromWalters(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "cbl" ?
|
||||
await _artifactService.StartImportingFromChesterBeatty(resourceNumber, friendlyUrl)
|
||||
:
|
||||
await _artifactService.StartImportingFromTheLibraryOfCongress(resourceNumber, friendlyUrl, resourcePrefix);
|
||||
await _artifactService.Import(srcType, resourceNumber, friendlyUrl, resourcePrefix);
|
||||
if (res.Result)
|
||||
return Ok();
|
||||
return BadRequest(res.ExceptionString);
|
||||
|
||||
@ -2485,106 +2485,14 @@
|
||||
<param name="stream"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromTheLibraryOfCongress(System.String,System.String,System.String)">
|
||||
<member name="M:RMuseum.Services.IArtifactService.Import(System.String,System.String,System.String,System.String)">
|
||||
<summary>
|
||||
for now it only supports https://www.loc.gov
|
||||
</summary>
|
||||
<param name="resourceNumber">
|
||||
<example>
|
||||
m084
|
||||
</example>
|
||||
</param>
|
||||
<param name="fiendlyUrl">
|
||||
<example>
|
||||
boostan1207
|
||||
</example>
|
||||
</param>
|
||||
<param name="resourcePrefix"></param>
|
||||
<example>
|
||||
plmp
|
||||
</example>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromPrinceton(System.String,System.String)">
|
||||
<summary>
|
||||
from http://pudl.princeton.edu/
|
||||
</summary>
|
||||
<param name="resourceNumber">dj52w476m</param>
|
||||
<param name="friendlyUrl"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromHarvard(System.String,System.String)">
|
||||
<summary>
|
||||
from https://curiosity.lib.harvard.edu
|
||||
</summary>
|
||||
<param name="url">example: https://curiosity.lib.harvard.edu/islamic-heritage-project/catalog/40-990114893240203941</param>
|
||||
<param name="friendlyUrl"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromHarvardDirectly(System.String,System.String,System.String)">
|
||||
<summary>
|
||||
import from http://www.qajarwomen.org
|
||||
</summary>
|
||||
<param name="hardvardResourceNumber">43117279</param>
|
||||
<param name="friendlyUrl">atame</param>
|
||||
<param name="srcUrl">http://www.qajarwomen.org/fa/items/1018A10.html</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromHathiTrust(System.String,System.String)">
|
||||
<summary>
|
||||
from https://catalog.hathitrust.org
|
||||
</summary>
|
||||
<param name="resourceNumber">006814127</param>
|
||||
<param name="friendlyUrl"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromPenLibraries(System.String,System.String)">
|
||||
<summary>
|
||||
from http://www.library.upenn.edu/
|
||||
</summary>
|
||||
<param name="resourceNumber">MEDREN_9949222153503681</param>
|
||||
<param name="friendlyUrl"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromCambridge(System.String,System.String)">
|
||||
<summary>
|
||||
from http://cudl.lib.cam.ac.uk
|
||||
</summary>
|
||||
<param name="resourceNumber">MS-RAS-00258</param>
|
||||
<param name="friendlyUrl"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromBritishLibrary(System.String,System.String)">
|
||||
<summary>
|
||||
from http://www.bl.uk
|
||||
</summary>
|
||||
<param name="resourceNumber">grenville_xli_f001r</param>
|
||||
<param name="friendlyUrl"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromServerFolder(System.String,System.String,System.String)">
|
||||
<summary>
|
||||
import from server folder
|
||||
</summary>
|
||||
<param name="folderPath">C:\Tools\batches\florence</param>
|
||||
<param name="friendlyUrl">shahname-florence</param>
|
||||
<param name="srcUrl">https://t.me/dr_khatibi_abolfazl/888</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromWalters(System.String,System.String)">
|
||||
<summary>
|
||||
from http://www.thedigitalwalters.org/01_ACCESS_WALTERS_MANUSCRIPTS.html
|
||||
</summary>
|
||||
<param name="resourceNumber">W619</param>
|
||||
<param name="friendlyUrl">golestan-walters-01</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.StartImportingFromChesterBeatty(System.String,System.String)">
|
||||
<summary>
|
||||
import from https://viewer.cbl.ie
|
||||
import from external resources
|
||||
</summary>
|
||||
<param name="srcType">loc/princeton/harvard/qajarwomen/hathitrust/penn/cam/bl/folder/walters/cbl</param>
|
||||
<param name="resourceNumber">119</param>
|
||||
<param name="friendlyUrl">golestan-baysonghori</param>
|
||||
<param name="resourcePrefix"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IArtifactService.RescheduleJobs">
|
||||
@ -3099,6 +3007,16 @@
|
||||
<param name="stream"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ArtifactService.Import(System.String,System.String,System.String,System.String)">
|
||||
<summary>
|
||||
import from external resources
|
||||
</summary>
|
||||
<param name="srcType">loc/princeton/harvard/qajarwomen/hathitrust/penn/cam/bl/folder/walters/cbl</param>
|
||||
<param name="resourceNumber">119</param>
|
||||
<param name="friendlyUrl">golestan-baysonghori</param>
|
||||
<param name="resourcePrefix"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ArtifactService.StartImportingFromTheLibraryOfCongress(System.String,System.String,System.String)">
|
||||
<summary>
|
||||
from https://www.loc.gov
|
||||
|
||||
@ -252,106 +252,14 @@ namespace RMuseum.Services
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// for now it only supports https://www.loc.gov
|
||||
/// </summary>
|
||||
/// <param name="resourceNumber">
|
||||
/// <example>
|
||||
/// m084
|
||||
/// </example>
|
||||
/// </param>
|
||||
/// <param name="fiendlyUrl">
|
||||
/// <example>
|
||||
/// boostan1207
|
||||
/// </example>
|
||||
/// </param>
|
||||
/// <param name="resourcePrefix"></param>
|
||||
/// <example>
|
||||
/// plmp
|
||||
/// </example>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromTheLibraryOfCongress(string resourceNumber, string fiendlyUrl, string resourcePrefix);
|
||||
|
||||
/// <summary>
|
||||
/// from http://pudl.princeton.edu/
|
||||
/// </summary>
|
||||
/// <param name="resourceNumber">dj52w476m</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromPrinceton(string resourceNumber, string friendlyUrl);
|
||||
|
||||
/// <summary>
|
||||
/// from https://curiosity.lib.harvard.edu
|
||||
/// </summary>
|
||||
/// <param name="url">example: https://curiosity.lib.harvard.edu/islamic-heritage-project/catalog/40-990114893240203941</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromHarvard(string url, string friendlyUrl);
|
||||
|
||||
/// <summary>
|
||||
/// import from http://www.qajarwomen.org
|
||||
/// </summary>
|
||||
/// <param name="hardvardResourceNumber">43117279</param>
|
||||
/// <param name="friendlyUrl">atame</param>
|
||||
/// <param name="srcUrl">http://www.qajarwomen.org/fa/items/1018A10.html</param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromHarvardDirectly(string hardvardResourceNumber, string friendlyUrl, string srcUrl);
|
||||
|
||||
/// <summary>
|
||||
/// from https://catalog.hathitrust.org
|
||||
/// </summary>
|
||||
/// <param name="resourceNumber">006814127</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromHathiTrust(string resourceNumber, string friendlyUrl);
|
||||
|
||||
/// <summary>
|
||||
/// from http://www.library.upenn.edu/
|
||||
/// </summary>
|
||||
/// <param name="resourceNumber">MEDREN_9949222153503681</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromPenLibraries(string resourceNumber, string friendlyUrl);
|
||||
|
||||
/// <summary>
|
||||
/// from http://cudl.lib.cam.ac.uk
|
||||
/// </summary>
|
||||
/// <param name="resourceNumber">MS-RAS-00258</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromCambridge(string resourceNumber, string friendlyUrl);
|
||||
|
||||
/// <summary>
|
||||
/// from http://www.bl.uk
|
||||
/// </summary>
|
||||
/// <param name="resourceNumber">grenville_xli_f001r</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromBritishLibrary(string resourceNumber, string friendlyUrl);
|
||||
|
||||
/// <summary>
|
||||
/// import from server folder
|
||||
/// </summary>
|
||||
/// <param name="folderPath">C:\Tools\batches\florence</param>
|
||||
/// <param name="friendlyUrl">shahname-florence</param>
|
||||
/// <param name="srcUrl">https://t.me/dr_khatibi_abolfazl/888</param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromServerFolder(string folderPath, string friendlyUrl, string srcUrl);
|
||||
|
||||
/// <summary>
|
||||
/// from http://www.thedigitalwalters.org/01_ACCESS_WALTERS_MANUSCRIPTS.html
|
||||
/// </summary>
|
||||
/// <param name="resourceNumber">W619</param>
|
||||
/// <param name="friendlyUrl">golestan-walters-01</param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromWalters(string resourceNumber, string friendlyUrl);
|
||||
|
||||
/// <summary>
|
||||
/// import from https://viewer.cbl.ie
|
||||
/// import from external resources
|
||||
/// </summary>
|
||||
/// <param name="srcType">loc/princeton/harvard/qajarwomen/hathitrust/penn/cam/bl/folder/walters/cbl</param>
|
||||
/// <param name="resourceNumber">119</param>
|
||||
/// <param name="friendlyUrl">golestan-baysonghori</param>
|
||||
/// <param name="resourcePrefix"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> StartImportingFromChesterBeatty(string resourceNumber, string friendlyUrl);
|
||||
Task<RServiceResult<bool>> Import(string srcType, string resourceNumber, string friendlyUrl, string resourcePrefix);
|
||||
|
||||
/// <summary>
|
||||
/// reschedule jobs
|
||||
|
||||
@ -1339,6 +1339,50 @@ namespace RMuseum.Services.Implementation
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// import from external resources
|
||||
/// </summary>
|
||||
/// <param name="srcType">loc/princeton/harvard/qajarwomen/hathitrust/penn/cam/bl/folder/walters/cbl</param>
|
||||
/// <param name="resourceNumber">119</param>
|
||||
/// <param name="friendlyUrl">golestan-baysonghori</param>
|
||||
/// <param name="resourcePrefix"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> Import(string srcType, string resourceNumber, string friendlyUrl, string resourcePrefix)
|
||||
{
|
||||
return
|
||||
srcType == "princeton" ?
|
||||
await StartImportingFromPrinceton(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "harvard" ?
|
||||
await StartImportingFromHarvard(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "qajarwomen" ?
|
||||
await StartImportingFromHarvardDirectly(resourceNumber, friendlyUrl, resourcePrefix)
|
||||
:
|
||||
srcType == "hathitrust" ?
|
||||
await StartImportingFromHathiTrust(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "penn" ?
|
||||
await StartImportingFromPenLibraries(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "cam" ?
|
||||
await StartImportingFromCambridge(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "bl" ?
|
||||
await StartImportingFromBritishLibrary(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "folder" ?
|
||||
await StartImportingFromServerFolder(resourceNumber, friendlyUrl, resourcePrefix)
|
||||
:
|
||||
srcType == "walters" ?
|
||||
await StartImportingFromWalters(resourceNumber, friendlyUrl)
|
||||
:
|
||||
srcType == "cbl" ?
|
||||
await StartImportingFromChesterBeatty(resourceNumber, friendlyUrl)
|
||||
:
|
||||
await StartImportingFromTheLibraryOfCongress(resourceNumber, friendlyUrl, resourcePrefix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -1359,7 +1403,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// plmp
|
||||
/// </example>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromTheLibraryOfCongress(string resourceNumber, string friendlyUrl, string resourcePrefix)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromTheLibraryOfCongress(string resourceNumber, string friendlyUrl, string resourcePrefix)
|
||||
{
|
||||
string url = $"https://www.loc.gov/resource/{resourcePrefix}.{resourceNumber}/?fo=json&st=gallery";
|
||||
|
||||
@ -1869,7 +1913,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="resourceNumber">dj52w476m</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromPrinceton(string resourceNumber, string friendlyUrl)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromPrinceton(string resourceNumber, string friendlyUrl)
|
||||
{
|
||||
string url = $"http://pudl.princeton.edu/mdCompiler2.php?obj={resourceNumber}";
|
||||
if (
|
||||
@ -2323,7 +2367,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="url">example: https://curiosity.lib.harvard.edu/islamic-heritage-project/catalog/40-990114893240203941</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromHarvard(string url, string friendlyUrl)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromHarvard(string url, string friendlyUrl)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -2789,7 +2833,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="friendlyUrl">atame</param>
|
||||
/// <param name="srcUrl">http://www.qajarwomen.org/fa/items/1018A10.html</param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromHarvardDirectly(string hardvardResourceNumber, string friendlyUrl, string srcUrl)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromHarvardDirectly(string hardvardResourceNumber, string friendlyUrl, string srcUrl)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -2959,7 +3003,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="resourceNumber">006814127</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromHathiTrust(string resourceNumber, string friendlyUrl)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromHathiTrust(string resourceNumber, string friendlyUrl)
|
||||
{
|
||||
string url = $"https://catalog.hathitrust.org/Record/{resourceNumber}.xml";
|
||||
if (
|
||||
@ -3454,7 +3498,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="resourceNumber">MEDREN_9949222153503681</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromPenLibraries(string resourceNumber, string friendlyUrl)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromPenLibraries(string resourceNumber, string friendlyUrl)
|
||||
{
|
||||
string url = $"http://dla.library.upenn.edu/dla/medren/pageturn.html?id={resourceNumber}&rotation=0&size=0";
|
||||
if (
|
||||
@ -3932,7 +3976,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="resourceNumber">MS-RAS-00258</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromCambridge(string resourceNumber, string friendlyUrl)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromCambridge(string resourceNumber, string friendlyUrl)
|
||||
{
|
||||
string url = $"http://cudl.lib.cam.ac.uk/view/{resourceNumber}.json";
|
||||
if (
|
||||
@ -4379,7 +4423,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="resourceNumber">grenville_xli_f001r</param>
|
||||
/// <param name="friendlyUrl"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromBritishLibrary(string resourceNumber, string friendlyUrl)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromBritishLibrary(string resourceNumber, string friendlyUrl)
|
||||
{
|
||||
string url = $"http://www.bl.uk/manuscripts/Viewer.aspx?ref={resourceNumber}";
|
||||
if (
|
||||
@ -5060,7 +5104,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="friendlyUrl">shahname-florence</param>
|
||||
/// <param name="srcUrl">https://t.me/dr_khatibi_abolfazl/888</param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromServerFolder(string folderPath, string friendlyUrl, string srcUrl)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromServerFolder(string folderPath, string friendlyUrl, string srcUrl)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -5305,7 +5349,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="resourceNumber">W619</param>
|
||||
/// <param name="friendlyUrl">golestan-walters-01</param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromWalters(string resourceNumber, string friendlyUrl)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromWalters(string resourceNumber, string friendlyUrl)
|
||||
{
|
||||
string url = $"http://www.thedigitalwalters.org/Data/WaltersManuscripts/ManuscriptDescriptions/{resourceNumber}_tei.xml";
|
||||
if (
|
||||
@ -5768,7 +5812,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="resourceNumber">119</param>
|
||||
/// <param name="friendlyUrl">golestan-baysonghori</param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingFromChesterBeatty(string resourceNumber, string friendlyUrl)
|
||||
private async Task<RServiceResult<bool>> StartImportingFromChesterBeatty(string resourceNumber, string friendlyUrl)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user