Permalink
Browse files

Fixed the image search

  • Loading branch information...
1 parent 1350c64 commit 6828bef1a8fd121274d3123ee0bf5ddb750ae856 @IAmCoder IAmCoder committed Sep 29, 2015
@@ -91,6 +91,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\References\lucidcode.Controls.MultiSliderControl.dll</HintPath>
</Reference>
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>..\References\Newtonsoft.Json.dll</HintPath>
+ </Reference>
<Reference Include="Spell Checker, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\References\Spell Checker.dll</HintPath>
Oops, something went wrong.
Oops, something went wrong.
@@ -1,6 +1,7 @@
Imports System.Windows.Forms.DataVisualization.Charting
Imports System.Windows.Forms.DataVisualization
Imports System.Threading
+Imports Newtonsoft.Json
Public Class ImageBrowserForm
@@ -10,7 +11,7 @@ Public Class ImageBrowserForm
Private Images As New List(Of Image)
Private objSearchClass As New SearchClass()
- Private strLastSearch As String = "http://refer.istockphoto.com/ta.php?lc=062184042431004651&atid=128087%7CBannerID%3D128087%7CReferralMethod%3DLink&url=http%3A%2F%2Fwww.istockphoto.com"
+ Private strLastSearch As String = "https://api.gettyimages.com/v3/search/images/creative?phrase=light"
Private Sub ImageBrowserForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DoubleBuffered = True
@@ -60,7 +61,7 @@ Public Class ImageBrowserForm
Try
Catch ex As Exception
- MessageBox.Show(ex.Message, "LightenedDream.Dreams.SelectImage()", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ MessageBox.Show(ex.Message, "LightenedDream.Dreams.SelectImage()", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
@@ -90,7 +91,7 @@ Public Class ImageBrowserForm
pnlSearching.Visible = True
objSearchClass = New SearchClass
- strLastSearch = "http://refer.istockphoto.com/ta.php?lc=062184042431004651&atid=128087%7CBannerID%3D128087%7CReferralMethod%3DLink&url=http://www.istockphoto.com/search/text/" + txtKeywords.Text.Replace(" ", "_").Replace(vbNewLine, "_") + ""
+ strLastSearch = "https://api.gettyimages.com/v3/search/images/creative?phrase=" + txtKeywords.Text.Replace(" ", "_").Replace(vbNewLine, "_") + ""
objSearchClass.Keywords = strLastSearch
objSearchClass.Completed = False
'AddHandler objSearchClass.ThumbnailAdded, AddressOf ThumbnailAdded
@@ -147,59 +148,30 @@ Public Class ImageBrowserForm
Try
Dim objWebClient As New System.Net.WebClient
+ objWebClient.Headers.Add("Api-Key", "5z67acwgvytgqsnw9ae4vwwg")
strSource = objWebClient.DownloadString(Keywords)
- intStart = strSource.IndexOf("istock.search.event.fire", intStart)
- Do
- Dim intLastIndex = intStart
- intStart = strSource.IndexOf("title", intStart) + 8
-
- If intStart <= intLastIndex Then Exit Do
-
- intEnd = strSource.IndexOf(""",""", intStart)
- Dim strTitle As String = strSource.Substring(intStart, intEnd - intStart)
+ Dim objImages = JsonConvert.DeserializeObject(strSource)
- If strTitle.Contains("Ghost-like") Then
- strTitle = strTitle
- End If
-
- intStart = strSource.IndexOf("file_thumbview_approve", intStart)
+ For Each objImage As Object In objImages("images")
- If intStart = -1 Then
- Exit Do
- End If
-
- intStart = strSource.IndexOf("\/", intStart) + 2
-
- If intStart = -1 Then
- Exit Do
- End If
+ Dim objDownloadClass As New DownloadClass
+ objDownloadClass.Title = objImage("title")
+ objDownloadClass.FileID = objImage("display_sizes")(0)("uri")
+ objDownloadClass.ImageIndex = intImageIndex
+ objDownloadClass.Completed = False
+ AddHandler objDownloadClass.ListItemAdded, AddressOf ListItemAddedX
- intEnd = strSource.IndexOf("\/", intStart)
+ Dim objThread As New Thread(AddressOf objDownloadClass.DoDownloadWork)
+ objThread.Start()
- Dim strFileID As String = strSource.Substring(intStart, intEnd - intStart)
+ Thread.Sleep(2)
+ Application.DoEvents()
- If Not strFileID = "search" Then
-
- Dim objDownloadClass As New DownloadClass
- objDownloadClass.Title = strTitle
- objDownloadClass.FileID = strFileID
- objDownloadClass.ImageIndex = intImageIndex
- objDownloadClass.Completed = False
- AddHandler objDownloadClass.ListItemAdded, AddressOf ListItemAddedX
-
- Dim objThread As New Thread(AddressOf objDownloadClass.DoDownloadWork)
- objThread.Start()
-
- Thread.Sleep(2)
- Application.DoEvents()
-
- End If
-
- If Completed Then Exit Do
+ If Completed Then Exit For
intImageIndex += 1
- Loop
+ Next
' Wait for all the threads to complete
Dim intCompleted As Integer = intImageIndex * -1
@@ -214,7 +186,6 @@ Public Class ImageBrowserForm
Loop
-
Catch ex As Exception
End Try
@@ -242,7 +213,7 @@ Public Class ImageBrowserForm
Public Sub DoDownloadWork()
Try
Dim objWebClient As New System.Net.WebClient
- Dim arrImage As Byte() = objWebClient.DownloadData("http://www.istockphoto.com/file_thumbview_approve/" & FileID & "/1")
+ Dim arrImage As Byte() = objWebClient.DownloadData(FileID)
Thread.Sleep(2)
Application.DoEvents()
@@ -265,7 +236,7 @@ Public Class ImageBrowserForm
Catch ex As Exception
End Try
-
+
End Sub
End Class
@@ -299,7 +270,7 @@ Public Class ImageBrowserForm
End Sub
Private Sub lblRAC_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lblRAC.LinkClicked
- System.Diagnostics.Process.Start(strLastSearch)
+ System.Diagnostics.Process.Start("http://www.gettyimages.com")
End Sub
Private Sub ImageBrowserForm_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
@@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("lucidcode")>
<Assembly: AssemblyProduct("Dreams")>
-<Assembly: AssemblyCopyright("Copyright © lucidcode 2013 - 2014")>
+<Assembly: AssemblyCopyright("Copyright © lucidcode 2013 - 2015")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
-<Assembly: AssemblyVersion("3.3.5")>
-<Assembly: AssemblyFileVersion("3.3.5.0")>
+<Assembly: AssemblyVersion("3.3.7")>
+<Assembly: AssemblyFileVersion("3.3.7.0")>
@@ -154,13 +154,13 @@
"Entry"
{
"MsmKey" = "8:_817BAE5A67DFC0D0E3DA9718CBA83262"
- "OwnerKey" = "8:_D3FED1BB9B16412CB5D07596E74ED32A"
+ "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_817BAE5A67DFC0D0E3DA9718CBA83262"
- "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
+ "OwnerKey" = "8:_D3FED1BB9B16412CB5D07596E74ED32A"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@@ -220,13 +220,13 @@
"Entry"
{
"MsmKey" = "8:_9CD9849FB1DDC7651BA91A4CEB1BCEF2"
- "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
+ "OwnerKey" = "8:_35D4F11B07B3EA86261CB22154718AC1"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_9CD9849FB1DDC7651BA91A4CEB1BCEF2"
- "OwnerKey" = "8:_35D4F11B07B3EA86261CB22154718AC1"
+ "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@@ -250,7 +250,7 @@
"Entry"
{
"MsmKey" = "8:_ACD565A9F6B1C38F014FCAE19ED50833"
- "OwnerKey" = "8:_209CE2F5DD0EF1332BB667BDFF4A3E0E"
+ "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@@ -262,7 +262,7 @@
"Entry"
{
"MsmKey" = "8:_ACD565A9F6B1C38F014FCAE19ED50833"
- "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
+ "OwnerKey" = "8:_209CE2F5DD0EF1332BB667BDFF4A3E0E"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@@ -340,7 +340,7 @@
"Entry"
{
"MsmKey" = "8:_D077E39B98A36D5D669260A1C12F8ADD"
- "OwnerKey" = "8:_817BAE5A67DFC0D0E3DA9718CBA83262"
+ "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@@ -352,7 +352,7 @@
"Entry"
{
"MsmKey" = "8:_D077E39B98A36D5D669260A1C12F8ADD"
- "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
+ "OwnerKey" = "8:_817BAE5A67DFC0D0E3DA9718CBA83262"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@@ -388,13 +388,13 @@
"Entry"
{
"MsmKey" = "8:_E758BDDD7428009B669946F6AFCB6C4C"
- "OwnerKey" = "8:_D3FED1BB9B16412CB5D07596E74ED32A"
+ "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_E758BDDD7428009B669946F6AFCB6C4C"
- "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
+ "OwnerKey" = "8:_D3FED1BB9B16412CB5D07596E74ED32A"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@@ -430,43 +430,43 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_9994C7C9E0CB939F6472723D7F6C91B5"
+ "OwnerKey" = "8:_F8D598C65566454E962DDB09A7917F7B"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_7183F4A5589815B3EBDC745E2C9576E1"
+ "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_E758BDDD7428009B669946F6AFCB6C4C"
+ "OwnerKey" = "8:_C7CE5E935BFC751568B43192BF4B02B2"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_D077E39B98A36D5D669260A1C12F8ADD"
+ "OwnerKey" = "8:_9CD9849FB1DDC7651BA91A4CEB1BCEF2"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_817BAE5A67DFC0D0E3DA9718CBA83262"
+ "OwnerKey" = "8:_35D4F11B07B3EA86261CB22154718AC1"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_C830F1C4869A85D879B79183B7862573"
+ "OwnerKey" = "8:_209CE2F5DD0EF1332BB667BDFF4A3E0E"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_ACD565A9F6B1C38F014FCAE19ED50833"
+ "OwnerKey" = "8:_96C1D0D28C3F6C09B696B92908F7805C"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@@ -478,43 +478,43 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_96C1D0D28C3F6C09B696B92908F7805C"
+ "OwnerKey" = "8:_ACD565A9F6B1C38F014FCAE19ED50833"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_209CE2F5DD0EF1332BB667BDFF4A3E0E"
+ "OwnerKey" = "8:_C830F1C4869A85D879B79183B7862573"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_35D4F11B07B3EA86261CB22154718AC1"
+ "OwnerKey" = "8:_817BAE5A67DFC0D0E3DA9718CBA83262"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_9CD9849FB1DDC7651BA91A4CEB1BCEF2"
+ "OwnerKey" = "8:_D077E39B98A36D5D669260A1C12F8ADD"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_C7CE5E935BFC751568B43192BF4B02B2"
+ "OwnerKey" = "8:_E758BDDD7428009B669946F6AFCB6C4C"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_C4DC007AD1F496A223A19B40E8BFC7EC"
+ "OwnerKey" = "8:_7183F4A5589815B3EBDC745E2C9576E1"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
- "OwnerKey" = "8:_F8D598C65566454E962DDB09A7917F7B"
+ "OwnerKey" = "8:_9994C7C9E0CB939F6472723D7F6C91B5"
"MsmSig" = "8:_UNDEFINED"
}
}
@@ -614,7 +614,7 @@
{
"Name" = "8:.NET Framework"
"Message" = "8:[VSDNETMSG]"
- "FrameworkVersion" = "8:3.5.30729 "
+ "FrameworkVersion" = "8:3.5.30729 "
"AllowLaterVersions" = "11:FALSE"
"InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=76617"
}
@@ -2025,15 +2025,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Lightened Dream"
- "ProductCode" = "8:{9F7AACF7-AF0D-432E-8BF5-C500FC664DCB}"
- "PackageCode" = "8:{0AE10330-74EE-4565-A1EC-8F240A16C149}"
+ "ProductCode" = "8:{A168661D-034B-4C99-B79F-0B46C699A15A}"
+ "PackageCode" = "8:{51DCEEC7-9776-4AA3-BD91-C93E535C41C4}"
"UpgradeCode" = "8:{323AF716-90AF-44C2-A6BD-4F7D4345EED6}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:TRUE"
- "ProductVersion" = "8:3.3.6"
+ "ProductVersion" = "8:3.3.7"
"Manufacturer" = "8:lucidcode"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:http://www.lucidcode.com/LightenedDream"
@@ -2938,7 +2938,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_D3FED1BB9B16412CB5D07596E74ED32A"
{
- "SourcePath" = "8:..\\Lightened Dream\\obj\\x86\\Release\\Lightened Dream.exe"
+ "SourcePath" = "8:..\\Lightened Dream\\obj\\Debug\\Lightened Dream.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_59F5C9F577BE4DEF9BA1216434C509E1"
Oops, something went wrong.

0 comments on commit 6828bef

Please sign in to comment.